Xojo Conferences

DynaPDF Manual - Page 564

Previous Page 563   Index   Next Page 565

Function Reference
Page 564 of 770
{1, 0, 0, 1, 0, 0}
TExtColorSpace, IColorSpace*
esDeviceGray, NULL
If vector graphics should be processed in a unique device color space then it is usually best to
convert PDF colors directly to the device color space with ConvColor() and to store the device color
then in the graphics state. The data type of the members FillColor and StrokeColor must then be
changed to unsigned int (UI32). There is no need to store the fill and stroke color space in the
graphics state in this case.
Vector graphics are defined in page or form space depending on the object type in which the
graphics are stored. The mapping to user space is achieved by tranforming the coordinate pairs with
the current transformation matrix of the graphics state.
For example, if the TMoveTo callback function would be executed the application must transform
the provided coordinates to user space as follows:
// x and y are the parameters of the TMoveTo callback function
Transform(m_GState.Matrix, x, y);
Vector graphics in PDF are always defined as paths. A path is invisible until it will be filled or
stroked. PDF supports primitive path painting operators like bezier curves, lines, and rectangles
only. Circles and ellipses are always drawn with bezier curves in PDF.
Once a path was fully defined it is normally consumed by a TClosePath() or TClipPath() callback
function call. If this is not the case the path must be deleted when the page was fully processed.
When a path must be filled, stroked, or discarded the TClosePath callback function is executed. The
parameter Mode of the callback function specifies what must be done with the path:
// Fill the path (Winding)
// Fill the path (Even Odd)
// Close, fill and stroke the path (Winding)
// Close, fill and stroke the path (Even Odd)
// Fill and stroke the path (Winding)
fmFillStrokeEvOddNoClose // Fill and stroke the path (Even Odd)
// Stroke the path
// Close and stroke the path
// Discard the path
// Close the path with a straight line segment
A normal path is not part of the graphics state. Once a path was drawn it must be deleted.
The TClipPath callback function supports the same modes than TClosePath but the required actions
that must be executed are different. A clipping path is part of the graphics state. If the graphics state
contains already a clipping path, the existing path must be intersected with new one. The resulting
clipping path must then be stored in the graphics state.

Previous topic: Vector Graphics

Next topic: PlaceImage