SaveVectorState()
Syntax
SaveVectorState()Description
Saves the current vector drawing state to be restored later. Multiple states can be saved on a stack and restored in the reverse order they were saved.
The following information is saved with this command:
- The coordinate transformations
- The drawing source
- The drawing font
- The clipping path
Note that the current path is not saved by this command.
Parameters
None.
Return value
None.
Example
If OpenWindow(0, 0, 0, 400, 200, "VectorDrawing", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CanvasGadget(0, 0, 0, 400, 200)
LoadFont(0, "Times New Roman", 20, #PB_Font_Bold)
If StartVectorDrawing(CanvasVectorOutput(0))
VectorSourceColor(RGBA(255, 0, 0, 255))
VectorFont(FontID(0))
MovePathCursor(20, 20)
DrawVectorText("Normal text")
; Changes made to the drawing state within this block do not affect the other commands
SaveVectorState()
MovePathCursor(120, 160)
RotateCoordinates(120, 160, -50)
VectorSourceColor(RGBA(0, 0, 255, 255))
DrawVectorText("Rotated text")
RestoreVectorState()
MovePathCursor(220, 140)
DrawVectorText("Normal text")
StopVectorDrawing()
EndIf
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
See Also
RestoreVectorState(), BeginVectorLayer()
Supported OS
All