7.6

Table Of Contents
Syntax
grestore()
Argument
None
Code Sample Example
See "GSave (procedure)" (page 566).
GSave (procedure)
This command saves all current system parameters, which can later be restored using the grestore command. By bracketing
parts of your PlanetPress Talk programs with gsave/grestore commands, you can make sure the current system state is
preserved and remains unaffected by whatever operations your program executes. For instance, each PlanetPress object,
once converted to its PlanetPress Talk scripting language equivalent, begins with a gsave command and ends with a gre-
store, thus ensuring objects do not interfere with each other, or with the system.
The system parameters gsave saves include current line width, current stroke color, and current fill color.
Syntax
gsave()
Argument
None
Code Sample Example
In this example, the current position is set first and saved.
gsave and grestore do not have to be issued in pairs. Issuing two consecutive gsave commands without a call to grestore
simply replaces the previously saved parameters on the stack, while issuing two grestore commands simply restores the
same stack of parameters twice.
Example
moveto( 1, 1 )
%Position is now 1,1
gsave()
%Save current state
lineto( 2, 1 )
%Position is now 2,1
lineto( 2, 2 )
%Position is now 2,2
grestore()
%Restore previous state: position is now 1,1
©2010 Objectif Lune Inc - 566 -