iOSGraphics.SaveState

From Xojo Documentation

Method

iOSGraphics.SaveState()

Supported on Mobile(iOS).

Saves graphics state of the graphics context so that it can be restored later.

Notes

These values are saved with SaveState and are restored when you call RestoreState.

  • Translation
  • Clip region
  • LineWidth
  • AntiAlias
  • FillColor
  • LineColor
  • Alpha value
  • TextFont
  • TextUnderline
  • Rotation

Sample Code

From within an iOSCanvas.Paint event handler:

g.FillColor = Color.Blue
g.FillRect(10, 10, 20, 20)

g.SaveState
g.FillColor = Color.Red
g.FillRect(50, 50, 20, 20)

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