Saves the current GDI+ state (transformations, clipping region, and quality settings) of the canvas. Note that this does not include Fill, Stroke, or Font properties. To also save these properties, call SaveState instead.
Call SaveCurrentState to save the drawing and filling properties in different moments of the drawing process.
SaveCurrentState returns a TRSGPSaveState object.
To restore the saved states, call RestoreCurrentState.
Namespace: RSGdiPlusGraphics
Delphi |
public |
Return Value
Type: TRSGPSaveState
When you call the SaveCurrentState method, an information block that holds the state of the GDI+ Graphics object (which the TRSGPCanvas encapsulates) is put on a stack. Note that the Canvas properties Fill/Brush, Stroke/Pen, Font, and StringFormat are not saved. The method returns a value that identifies that information block. When you pass the identifying value to the RestoreCurrentState method, the information block is removed from the stack and is used to restore the GDI+ Graphics object to the state it was in at the time of the SaveCurrentState call. Note that the identifier returned by a given call to the SaveCurrentState method can be passed only once to the RestoreCurrentState method. Calls to the SaveCurrentState method can be nested; that is, you can call the SaveCurrentState method several times before you call the RestoreCurrentState method. Each time you call the SaveCurrentState method, an information block is put on the stack, and you receive an identifier for the information block. When you pass one of those identifiers to the RestoreCurrentState method, the GDI+ Graphics object is returned to the state it was in at the time of the SaveCurrentState call that returned that particular identifier (excluding Fill, Stroke, and Font properties). The information block placed on the stack by that SaveCurrentState call is removed from the stack, and all information blocks placed on that stack after that SaveCurrentState call are also removed. |