Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

DynaPDF Manual - Page 532

Previous Page 531   Index   Next Page 533

Function Reference
Page 532 of 750
be set to NULL. Null means the matrix is set to the identity matrix. To transform form space
to user space the form matrix must be multiplied with the one of the current graphics state.
Patterns are defined in pattern space. The transformation from pattern space to the initial
default user space of the object in which it is used is provided in the TBeginPattern callback
function. However, the matrix parameter of the callback function is optional and can be set to
NULL. Null means the matrix is set to the identity matrix. Note that patterns are treated like
a color. The TBeginPattern callback function starts the definition of the pattern and activates
it in the graphics state when the corresponding TEndPattern callback function is executed.
However, a pattern is applied when the next fill or stroke path operation occurs and if the
pattern was defined as fill or stroke color.
o If a pattern is used on a page, the pattern matrix maps pattern space to the default
(initial) coordinate space of the page. Changes to the page’s transformation matrix
that occur within the page’s content stream, such as rotation and scaling, have no
effect on the pattern; it maintains its original relationship to the page no matter where
on the page it is used. Similarly, if a pattern is used within a template, the pattern
matrix maps pattern space to the template's default user space (that is, the template
coordinate space at the time the template is painted). A pattern may be used within
another pattern; the inner pattern’s matrix defines its relationship to the pattern space
of the outer pattern.
Working with Transformation Matrices
Coordinate transformations in PDF are achieved with so called Affine Transformations. Affine
transformations can represent any linear mapping from one coordinate system to another.
Affine transformations work with transformation matrices which consist of 6 real numbers. A
transformation matrix describes the coordinate origin, scaling factors of the x- and y-axis, as well as
the rotation angle of the coordinate system. A transformation matrix represents essentially a
coordinate space in which graphical objects can be drawn. Two coordinate spaces can easily be
concatenated by multiplying the corresponding transformation matrices.
Coordinates of objects which use their own coordinate space, such a text, templates, or patterns,
must be transformed to user space before the coordinates can be used. How this must be done is
described later.
Transformation matrices in DynaPDF are stored in the structure TCTM that is defined as follows:
struct TCTM
double a;
double b;
double c;
double d;
double x;
double y;

Previous topic: Coordinate Spaces

Next topic: Helper Functions