iOSGraphics.SaveState

From Xojo Documentation

Revision as of 16:22, 20 August 2018 by PLefebvre (talk | contribs) (Created page with "{{MethodBox | name = SaveState | ownertype = class | scope = public | parameters = | owner = iOSGraphics | project=Mobile | target=iOS }} {{Description | text = Saves gra...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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)