DynaPDF Manual - Page 671

Previous Page 670   Index   Next Page 672

Function Reference
Page 671 of 839
SaveGraphicState
Syntax:
LBOOL pdfSaveGraphicState(
const PPDF* IPDF) // Instance pointer
The function saves the current graphics state. A saved graphics state must be restored before the
page, template or pattern will be closed.
DynaPDF maintains an internal data structure called the graphics state that holds current graphics
control parameters. These parameters define the global framework within which the graphics
operators execute.
A well-structured PDF document typically contains many graphical elements that are essentially
independent of each other and sometimes nested to multiple levels. The graphics state stack allows
these elements to make local changes to the graphics state without disturbing the graphics state of
the surrounding environment. The stack is a LIFO (last in, first out) data structure in which the
contents of the graphics state can be saved and later restored using the following functions:
SaveGraphicState() pushes a copy of the graphics state onto the stack.
RestoreGraphicState() restores the graphics state to its former value by popping it from the
stack.
These functions can be used to encapsulate a graphical element so that it can modify parameters of
the graphics state and later restore them to their previous values.
The maximum allowed nesting level is 28 in PDF 1.7. This is not a limit as such, but arises from the
fact that the corresponding q and Q operators are implemented by the PostScript gsave and grestore
operators when generating PostScript output.
The graphics state consists of the following variables:
Parameter
Data type
Initial Value
CharSpacing
float
0.0f
Clipping Path
Vector array
Crop box or Media box
DashPattern
double*
NULL (Solid line)
DashPhase
UI32
0
FillColor
BYTE[32]
Black
FillColorSpace
TExtColorSpace, IColorSpace*
esDeviceRGB, NULL
FillPattern
IPattern*
NULL
Font
IFont*
NULL
Leading
float
0.0f
LineCapStyle
TLineCapStyle
csButtCap
LineJoinStyle
TLineJoinStyle
jsMiterJoin
LineWidth
float
1.0f
Matrix
TCTM
{1, 0, 0, 1, 0, 0}
MiterLimit
float
10.0f
StrokeColor
BYTE[32]
Black
StrokeColorSpace
TExtColorSpace, IColorSpace*
esDeviceRGB, NULL
 

Previous topic: RoundRectEx

Next topic: ScaleCoords