Difference between revisions of "Graphics.RestoreState"

From Xojo Documentation

Line 4: Line 4:
 
| scope = public
 
| scope = public
 
| owner = [[Graphics]]
 
| owner = [[Graphics]]
| project=Mobile
 
| target=iOS
 
 
| newinversion=2020r2
 
| newinversion=2020r2
 
}}
 
}}

Revision as of 18:54, 11 March 2021

Method

Graphics.RestoreState()

New in 2020r2

Supported for all project types and targets.

Restores graphics context previously saved with SaveState.

Sample Code

From within an MobileCanvas.Paint event handler:

g.DrawingColor = Color.Blue
g.FillRectangle(10, 10, 20, 20)

g.SaveState
g.DrawingColor = Color.Red
g.FillRectangle(50, 50, 20, 20)

// Restore to state where FillColor is Blue
g.RestoreState
g.FillRectangle(10, 50, 20, 20)