Syntax
EndDraw()
Description
Finalizes the drawing operations initiated by the corresponding BeginDraw() call for the current output target. This typically involves presenting the rendered content (for windows) or completing the drawing process (for images) and releasing associated temporary resources.
Parameters
This command takes no parameters.
Return Value
This command does not return a value.
Remarks
Every call to BeginDraw() must be balanced with a call to
EndDraw(). Failure to do so can lead to resource leaks, drawing errors, or application
instability. Calling EndDraw() removes the current drawing context from ProGUI's internal
stack. If drawing to a window using DirectComposition on Windows, this call also triggers the commit
process to display the changes.
Example
IncludeFile "ProGUI_PB.pbi"
StartProGUI()
MyWindow = CreateWindow(0, 0, 400, 300, "EndDraw Example")
Procedure DrawHandler(Window, EventType, *EventData.PG_EventDraw, *UserData)
; --- Start Drawing Session --- BeginDraw to a window output target is handled automatically internally for draw event handlers
DrawClear(RGB(200, 200, 200), 1) ; Grey background
DrawBox(10, 10, 100, 50, RGB(255, 0, 0)) ; Draw a red box
; --- End Drawing Session --- EndDraw is handled automatically internally
EndProcedure
If MyWindow
AddEventHandler(MyWindow, #PG_Event_Draw, @DrawHandler())
WindowShow(MyWindow, #True, #PG_Window_ScreenCentered)
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
StopProGUI()
See Also
BeginDraw, OutputWindow, OutputImg
Supported OS
Windows, Linux