Requires: Direct2D.lg32
Ends drawing operations on the render target and returns the current error state.
[error = ] D2EndDraw
error | : integer |
Drawing operations are always embedded between a D2BeginDraw and a D2EndDraw command.
After D2BeginDraw is called, a render target will normally build up a batch of rendering commands, but defer processing of these commands until D2EndDraw is called. The D2EndDraw function causes any batched drawing operations to complete, and then returns an HRESULT indicating the success of the operations.
D2EndDraw clears the settings made with D2Color, D2DefLine, D2DefFill, D2Clip, and D2Transform.
'
' D2EndDraw sample (dpi-unaware)
'
$Library "direct2d"
Global Object Win1RT
Global Object brHatch, brChoc
OpenW 1, 0, 0, 320, 260, ~15
Win1InitD2
Do
Sleep
Until Me Is Nothing
Sub Win_1_Paint
D2BeginDraw Win1RT
D2Clear D2C_ForestGreen
D2DefFill brHatch
D2PCircle 320, 240, 100
D2DefFill brChoc
D2PBox 10, 10, 100, 100
D2EndDraw
If D2EndDrawError == D2DERR_RECREATE_TARGET
Win1InitD2 ' initialize D2
EndIf
EndSub
Proc Win1InitD2
Set Win1RT = D2GetRT(Me.hWnd, 640, 480) ' window, scaling
' Here: create Win_1 render target resources,
' like brushes, bitmaps, layers, meshes, and geometries.
Set brChoc = D2Brush(D2C_Chocolate)
Set brHatch = D2Brush("hatch0.bmp")
EndProc
If D2EndDraw is called without a matched call to D2BeginDraw, it returns an error indicating that D2BeginDraw must be called before D2EndDraw.
{Created by Sjouke Hamstra; Last updated: 19/03/2020 by James Gaite}