Syntax
EndLayer()
Description
Pops the current layer from the drawing stack and composites its content onto the underlying drawing target. This applies any opacity, opacity brush (mask), or border specified in the corresponding BeginLayer() call.
Parameters
This command takes no parameters.
Return Value
This command does not return a value.
Remarks
Every call to BeginLayer() must be balanced with a call to
EndLayer(). After EndLayer() is called, subsequent drawing operations render
directly onto the target that was active before the layer was started. The coordinate system also
reverts to what it was before BeginLayer().
Example
IncludeFile "ProGUI_PB.pbi"
StartProGUI()
Procedure DrawHandler(Window, EventType, *EventData.PG_EventDraw, *UserData)
DrawClear(RGB(200, 200, 200), 1)
; Draw something underneath
DrawBox(10, 10, 380, 280, RGB(0, 155, 0))
; Begin a layer with 50% opacity
BeginLayer(50, 50, 300, 200, 0.5)
; Draw content within the layer (coordinates are relative to layer origin 50,50)
DrawClear(RGB(255, 255, 0), 1) ; Layer background (yellow)
DrawBox(10, 10, 100, 100, RGB(255, 0, 0), 1) ; Red box inside layer
; End the layer - its content will be blended onto the window at 50% opacity
EndLayer()
; Draw something on top of the blended layer
DrawLine(0, 0, 400, 300, RGB(0,0,0))
EndProcedure
MyWindow = CreateWindow(0, 0, 400, 300, "Layer Example")
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
BeginLayer, BeginDraw, EndDraw, DrawSave, DrawRestore
Supported OS
Windows, Linux