<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://mitov.com/wiki/skins/common/feed.css?301"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://mitov.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Method_function_IGDIPlus.IGPGraphics.Save%28%29_%3A_TGPGraphicsState</id>
		<title>Method function IGDIPlus.IGPGraphics.Save() : TGPGraphicsState - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://mitov.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Method_function_IGDIPlus.IGPGraphics.Save%28%29_%3A_TGPGraphicsState"/>
		<link rel="alternate" type="text/html" href="https://mitov.com/wiki/index.php?title=Method_function_IGDIPlus.IGPGraphics.Save()_:_TGPGraphicsState&amp;action=history"/>
		<updated>2026-05-11T20:29:24Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.17.0</generator>

	<entry>
		<id>https://mitov.com/wiki/index.php?title=Method_function_IGDIPlus.IGPGraphics.Save()_:_TGPGraphicsState&amp;diff=11830&amp;oldid=prev</id>
		<title>David Alm: Automated Syncronization with Documentation</title>
		<link rel="alternate" type="text/html" href="https://mitov.com/wiki/index.php?title=Method_function_IGDIPlus.IGPGraphics.Save()_:_TGPGraphicsState&amp;diff=11830&amp;oldid=prev"/>
				<updated>2012-10-18T17:19:06Z</updated>
		
		<summary type="html">&lt;p&gt;Automated Syncronization with Documentation&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;b&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&lt;br /&gt;
This is a Beta Read Only version of this page. &lt;br /&gt;
Please review and send recommendations to [mailto:mitov@mitov.com mitov@mitov.com]. &lt;br /&gt;
We will enable the editing as soon as we are happy with the overall Wiki site.&lt;br /&gt;
&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Class:''' [[Interface IGDIPlus.IGPGraphics|IGPGraphics]]&lt;br /&gt;
&lt;br /&gt;
== Syntax ==&lt;br /&gt;
=== Delphi: ===&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
'''function''' Save() : TGPGraphicsState;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== C++ Builder: ===&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
TGPGraphicsState '''__fastcall''' Save();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Visual C++ (MFC): ===&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 Save();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
Saves the current state (transformations, clipping region, and quality settings) of this [[Class IGDIPlus.TGPGraphics|TGPGraphics]] object. &lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
Call this method to save the current state (transformations,&lt;br /&gt;
 clipping region, and quality settings) of this [[Class IGDIPlus.TGPGraphics|TGPGraphics]]&lt;br /&gt;
 object. You can restore the state later by calling the&lt;br /&gt;
 [[Class IGDIPlus.TGPGraphics|TGPGraphics]].[[Method function IGDIPlus.IGPGraphics.Restore(TGPGraphicsState) : TGPGraphics|Restore]] method.&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;b&amp;gt;Examples:&amp;lt;/b&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 The following examples show two ways to use the Save method.&lt;br /&gt;
 The first example shows how to restore nested saved states,&lt;br /&gt;
 and the second example shows how to restore only the first of&lt;br /&gt;
 two nested saved states.&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;b&amp;gt;Restoring Nested Saved States&amp;lt;/b&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 The following example sets the world transformation of a&lt;br /&gt;
 Graphics object to a rotation and then saves the state of the&lt;br /&gt;
 Graphics object. Next, the code calls [[Method function IGDIPlus.IGPGraphics.TranslateTransform(Single;Single;TGPMatrixOrder) : TGPGraphics|TranslateTransform]], and&lt;br /&gt;
 saves the state again. Then the code calls [[Method function IGDIPlus.IGPGraphics.ScaleTransform(Single;Single;TGPMatrixOrder) : TGPGraphics|ScaleTransform]]. At&lt;br /&gt;
 that point, the world transformation of the Graphics object&lt;br /&gt;
 is a composite transformation: first rotate, then translate,&lt;br /&gt;
 then scale. The code uses a red pen to draw an ellipse that&lt;br /&gt;
 is transformed by that composite transformation.&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 The code passes state2, which was returned by the second call&lt;br /&gt;
 to Save, to the [[Method function IGDIPlus.IGPGraphics.Restore(TGPGraphicsState) : TGPGraphics|Restore]] method, and draws the ellipse again&lt;br /&gt;
 using a green pen. The green ellipse is rotated and&lt;br /&gt;
 translated but not scaled. Finally the code passes state1,&lt;br /&gt;
 which was returned by the first call to Save, to the [[Method function IGDIPlus.IGPGraphics.Restore(TGPGraphicsState) : TGPGraphics|Restore]]&lt;br /&gt;
 method, and draws the ellipse again using a blue pen. The&lt;br /&gt;
 blue ellipse is rotated but not translated or scaled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 var&lt;br /&gt;
   AGraphics : [[Interface IGDIPlus.IGPGraphics|IGPGraphics]];&lt;br /&gt;
   AState1, AState2 : IGPGraphicsState;&lt;br /&gt;
 &lt;br /&gt;
 begin&lt;br /&gt;
   AGraphics := [[Class IGDIPlus.TGPGraphics|TGPGraphics]].Create( ACanvas );&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code lang=&amp;quot;delphi&amp;quot;&amp;gt;&lt;br /&gt;
   AGraphics.[[Method function IGDIPlus.IGPGraphics.RotateTransform(Single;TGPMatrixOrder) : TGPGraphics|RotateTransform]](30.0);&lt;br /&gt;
   AState1 = graphics.Save();&lt;br /&gt;
   AGraphics.[[Method function IGDIPlus.IGPGraphics.TranslateTransform(Single;Single;TGPMatrixOrder) : TGPGraphics|TranslateTransform]](100.0, 0.0, [[Enum item IGDIPlus.TGPMatrixOrder.MatrixOrderAppend|MatrixOrderAppend]]);&lt;br /&gt;
   AState2 = graphics.Save();&lt;br /&gt;
   AGraphics.[[Method function IGDIPlus.IGPGraphics.ScaleTransform(Single;Single;TGPMatrixOrder) : TGPGraphics|ScaleTransform]](1.0, 3.0, [[Enum item IGDIPlus.TGPMatrixOrder.MatrixOrderAppend|MatrixOrderAppend]]);&lt;br /&gt;
 &lt;br /&gt;
   // Draw an ellipse.&lt;br /&gt;
   // Three transformations apply: rotate, then translate, then scale.&lt;br /&gt;
   AGraphics.[[Method function IGDIPlus.IGPGraphics.DrawEllipse(IGPPen;TGPRect) : TGPGraphics|DrawEllipse]]([[Class IGDIPlus.TGPPen|TGPPen]].Create( aclRed ), 0, 0, 100, 20);&lt;br /&gt;
 &lt;br /&gt;
   // [[Method function IGDIPlus.IGPGraphics.Restore(TGPGraphicsState) : TGPGraphics|Restore]] to AState2 and draw the ellipse again.&lt;br /&gt;
   // Two transformations apply: rotate then translate.&lt;br /&gt;
   AGraphics.[[Method function IGDIPlus.IGPGraphics.Restore(TGPGraphicsState) : TGPGraphics|Restore]](AState2);&lt;br /&gt;
   AGraphics.[[Method function IGDIPlus.IGPGraphics.DrawEllipse(IGPPen;TGPRect) : TGPGraphics|DrawEllipse]]([[Class IGDIPlus.TGPPen|TGPPen]].Create( aclGreen ), 0, 0, 100, 20);&lt;br /&gt;
 &lt;br /&gt;
   // [[Method function IGDIPlus.IGPGraphics.Restore(TGPGraphicsState) : TGPGraphics|Restore]] to AState1 and draw the ellipse again.&lt;br /&gt;
   // Only the rotation transformation applies.&lt;br /&gt;
   AGraphics.[[Method function IGDIPlus.IGPGraphics.Restore(TGPGraphicsState) : TGPGraphics|Restore]](AState1);&lt;br /&gt;
   AGraphics.[[Method function IGDIPlus.IGPGraphics.DrawEllipse(IGPPen;TGPRect) : TGPGraphics|DrawEllipse]]( [[Class IGDIPlus.TGPPen|TGPPen]].Create( aclBlue ), 0, 0, 100, 20);&lt;br /&gt;
 end;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;b&amp;gt;Restoring Only the First of Two Nested Saved States&amp;lt;/b&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 The following example sets the world transformation of a&lt;br /&gt;
 Graphics object to a rotation and then saves the state of the&lt;br /&gt;
 Graphics object. Next, the code calls [[Method function IGDIPlus.IGPGraphics.TranslateTransform(Single;Single;TGPMatrixOrder) : TGPGraphics|TranslateTransform]], and&lt;br /&gt;
 saves the state again. Then the code calls [[Method function IGDIPlus.IGPGraphics.ScaleTransform(Single;Single;TGPMatrixOrder) : TGPGraphics|ScaleTransform]]. At&lt;br /&gt;
 that point, the world transformation of the Graphics object&lt;br /&gt;
 is a composite transformation: first rotate, then translate,&lt;br /&gt;
 then scale. The code uses a red pen to draw an ellipse that&lt;br /&gt;
 is transformed by that composite transformation.&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 The code passes state1, which was returned by the first call&lt;br /&gt;
 to Save, to the [[Method function IGDIPlus.IGPGraphics.Restore(TGPGraphicsState) : TGPGraphics|Restore]] method, and draws the ellipse again&lt;br /&gt;
 using a green pen. The green ellipse is rotated but not&lt;br /&gt;
 translated or scaled.&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 Next the code attempts to restore the state identified by&lt;br /&gt;
 state2. The attempt fails because the call [[Method function IGDIPlus.IGPGraphics.Restore(TGPGraphicsState) : TGPGraphics|Restore]](state1)&lt;br /&gt;
 removed the information blocks identified by both state1 and&lt;br /&gt;
 state2 from the stack.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 var&lt;br /&gt;
   AGraphics : [[Interface IGDIPlus.IGPGraphics|IGPGraphics]];&lt;br /&gt;
   AState1, AState2 : IGPGraphicsState;&lt;br /&gt;
 &lt;br /&gt;
 begin&lt;br /&gt;
   AGraphics := [[Class IGDIPlus.TGPGraphics|TGPGraphics]].Create( ACanvas );&lt;br /&gt;
 &lt;br /&gt;
   AGraphics.[[Method function IGDIPlus.IGPGraphics.RotateTransform(Single;TGPMatrixOrder) : TGPGraphics|RotateTransform]](30.0);&lt;br /&gt;
   AState1 = graphics.Save();&lt;br /&gt;
   AGraphics.[[Method function IGDIPlus.IGPGraphics.TranslateTransform(Single;Single;TGPMatrixOrder) : TGPGraphics|TranslateTransform]](100.0, 0.0, [[Enum item IGDIPlus.TGPMatrixOrder.MatrixOrderAppend|MatrixOrderAppend]]);&lt;br /&gt;
   AState2 = graphics.Save();&lt;br /&gt;
   AGraphics.[[Method function IGDIPlus.IGPGraphics.ScaleTransform(Single;Single;TGPMatrixOrder) : TGPGraphics|ScaleTransform]](1.0, 3.0, [[Enum item IGDIPlus.TGPMatrixOrder.MatrixOrderAppend|MatrixOrderAppend]]);&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code lang=&amp;quot;delphi&amp;quot;&amp;gt;&lt;br /&gt;
   // Draw an ellipse.&lt;br /&gt;
   // Three transformations apply: rotate, then translate, then scale.&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
   AGraphics.[[Method function IGDIPlus.IGPGraphics.DrawEllipse(IGPPen;TGPRect) : TGPGraphics|DrawEllipse]]([[Class IGDIPlus.TGPPen|TGPPen]].Create( aclRed ), 0, 0, 100, 20 );&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code lang=&amp;quot;delphi&amp;quot;&amp;gt;&lt;br /&gt;
   // [[Method function IGDIPlus.IGPGraphics.Restore(TGPGraphicsState) : TGPGraphics|Restore]] to AState1 and draw the ellipse again.&lt;br /&gt;
   // Only the rotation transformation applies.&lt;br /&gt;
   AGraphics.[[Method function IGDIPlus.IGPGraphics.Restore(TGPGraphicsState) : TGPGraphics|Restore]](AState1);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
   AGraphics.[[Method function IGDIPlus.IGPGraphics.DrawEllipse(IGPPen;TGPRect) : TGPGraphics|DrawEllipse]]([[Class IGDIPlus.TGPPen|TGPPen]].Create( aclGreen ), 0, 0, 100, 20 );&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code lang=&amp;quot;delphi&amp;quot;&amp;gt;&lt;br /&gt;
   // The information block identified by AState2 has been lost.&lt;br /&gt;
   // The following call to [[Method function IGDIPlus.IGPGraphics.Restore(TGPGraphicsState) : TGPGraphics|Restore]] has no effect because&lt;br /&gt;
   // [[Method function IGDIPlus.IGPGraphics.Restore(TGPGraphicsState) : TGPGraphics|Restore]](AState1) removed from the stack the&lt;br /&gt;
   // information blocks identified by AState1 and AState2.&lt;br /&gt;
   AGraphics.[[Method function IGDIPlus.IGPGraphics.Restore(TGPGraphicsState) : TGPGraphics|Restore]](AState2);&lt;br /&gt;
 &lt;br /&gt;
   // The Graphics object is still in the state identified by state1.&lt;br /&gt;
   // The following code draws a blue ellipse on top of the previously&lt;br /&gt;
   // drawn green ellipse.&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
   AGraphics.[[Method function IGDIPlus.IGPGraphics.DrawEllipse(IGPPen;TGPRect) : TGPGraphics|DrawEllipse]]([[Class IGDIPlus.TGPPen|TGPPen]].Create( aclBlue ), 0, 0, 100, 20 );&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Note&lt;br /&gt;
When you call the Save method of a Graphics object, an&lt;br /&gt;
information block that holds the state of the Graphics object&lt;br /&gt;
is put on a stack. The Save method returns a value that&lt;br /&gt;
identifies that information block. When you pass the&lt;br /&gt;
identifying value to the Graphics::[[Method function IGDIPlus.IGPGraphics.Restore(TGPGraphicsState) : TGPGraphics|Restore]] method, the&lt;br /&gt;
information block is removed from the stack and is used to&lt;br /&gt;
restore the Graphics object to the state it was in at the&lt;br /&gt;
time of the Save call. Note that the identifier returned by a&lt;br /&gt;
given call to the Save method can be passed only once to the&lt;br /&gt;
Graphics::[[Method function IGDIPlus.IGPGraphics.Restore(TGPGraphicsState) : TGPGraphics|Restore]] method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Calls to the Save method can be nested; that is, you can call&lt;br /&gt;
the Save method several times before you call the [[Method function IGDIPlus.IGPGraphics.Restore(TGPGraphicsState) : TGPGraphics|Restore]]&lt;br /&gt;
method. Each time you call the Save method, an information&lt;br /&gt;
block is put on the stack, and you receive an identifier for&lt;br /&gt;
the information block. When you pass one of those identifiers&lt;br /&gt;
to the [[Method function IGDIPlus.IGPGraphics.Restore(TGPGraphicsState) : TGPGraphics|Restore]] method, the Graphics object is returned to the&lt;br /&gt;
state it was in at the time of the Save call that returned&lt;br /&gt;
that particular identifier. The information block placed on&lt;br /&gt;
the stack by that Save call is removed from the stack, and&lt;br /&gt;
all information blocks placed on that stack after that Save&lt;br /&gt;
call are also removed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Calls to the [[Method function IGDIPlus.IGPGraphics.BeginContainer(TGPRect;TGPRect;TGPUnit) : TGPGraphicsContainer|BeginContainer]] method place information blocks&lt;br /&gt;
on the same stack as calls to the Save method. Just as a&lt;br /&gt;
Graphics::[[Method function IGDIPlus.IGPGraphics.Restore(TGPGraphicsState) : TGPGraphics|Restore]] call is paired with a Save call, an&lt;br /&gt;
[[Method function IGDIPlus.IGPGraphics.EndContainer(TGPGraphicsContainer) : TGPGraphics|EndContainer]] call is paired with a [[Method function IGDIPlus.IGPGraphics.BeginContainer(TGPRect;TGPRect;TGPUnit) : TGPGraphicsContainer|BeginContainer]] call.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note When you call [[Method function IGDIPlus.IGPGraphics.Restore(TGPGraphicsState) : TGPGraphics|Restore]], all information blocks placed on&lt;br /&gt;
the stack (by Save or by [[Method function IGDIPlus.IGPGraphics.BeginContainer(TGPRect;TGPRect;TGPUnit) : TGPGraphicsContainer|BeginContainer]]) after the&lt;br /&gt;
corresponding call to Save are removed from the stack.&lt;br /&gt;
Likewise, When you call [[Method function IGDIPlus.IGPGraphics.EndContainer(TGPGraphicsContainer) : TGPGraphics|EndContainer]], all information blocks&lt;br /&gt;
placed on the stack (by Save or by [[Method function IGDIPlus.IGPGraphics.BeginContainer(TGPRect;TGPRect;TGPUnit) : TGPGraphicsContainer|BeginContainer]]) after the&lt;br /&gt;
corresponding call to [[Method function IGDIPlus.IGPGraphics.BeginContainer(TGPRect;TGPRect;TGPUnit) : TGPGraphicsContainer|BeginContainer]] are removed from the&lt;br /&gt;
stack.&lt;/div&gt;</summary>
		<author><name>David Alm</name></author>	</entry>

	</feed>