Previous Next


                                        208
CHAPTER 4                                                                  Graphics



PDF represents coordinates in a two-dimensional space. The point (x, y) in such
a space can be expressed in vector form as [ x y 1 ]. The constant third element of
this vector (1) is needed so that the vector can be used with 3-by-3 matrices in the
calculations described below.

The transformation between two coordinate systems is represented by a 3-by-3
transformation matrix written as follows:

  a b 0
  c d 0
  e f 1

Because a transformation matrix has only six elements that can be changed, it is
usually specified in PDF as the six-element array [ a b c d e f ].

Coordinate transformations are expressed as matrix multiplications:

                             a b 0
[ x′ y′ 1 ] = [ x y 1 ] ×    c d 0
                             e f 1

Because PDF transformation matrices specify the conversion from the trans-
formed coordinate system to the original (untransformed) coordinate system, x ′
and y ′ in this equation are the coordinates in the untransformed coordinate sys-
tem, and x and y are the coordinates in the transformed system. The multiplica-
tion is carried out as follows:
x′ = a × x + c × y + e
y′ = b × x + d × y + f

If a series of transformations is carried out, the matrices representing each of the
individual transformations can be multiplied together to produce a single equiva-
lent matrix representing the composite transformation.

Matrix multiplication is not commutative—the order in which matrices are mul-
tiplied is significant. Consider a sequence of two transformations: a scaling trans-
formation applied to the user space coordinate system, followed by a conversion
from the resulting scaled user space to device space. Let MS be the matrix specify-
ing the scaling and MC the current transformation matrix, which transforms user

Previous Next