Matrix Class Documentation
classMatrixNamespace:com::datalogics::PDFL
Detailed Description
A transformation matrix in a PDF file is specified by six numbers. The matrix is usually in the form of an array containing the six elements [a b c d h v].
A translation is specified as [ 1 0 0 1 tx ty], where tx and ty are the distance to translate from the origin of the coordinate system in the horizontal and vertical dimension, respectively.
A scaling is obtained by [sx 0 0 sy 0 0]. This scales the coordinates so that 1 unit in the horizontal and vertical dimension of the new coordinate system is the same size as sx and sy units, respectively, as in the previous coordinate system.
A rotation is produced by [ cos T sin T -sin T cos T 0 0 ], which has the effect of rotating the coordinate system axes by an angle T (degrees) counterclockwise.
This material indicates that the matrix specifying a transformation is premultiplied with the current transformation matrix, i.e.,
M' = Mt * M
The implementation of the Scale, Rotate, and Translate convenience functions of Matrix reflect the same order of operations, so that they are consistent with the PDF Reference manual. They are also consistent with the scale, rotate, and translate operators in PostScript, from which the coordinate system model in PDF is derived.
Referenced by
Uses types
Constructor & Destructor Documentation
Matrix
Matrix()the default constructor creates a transformation matrix to translate the rectangle 1 element (1/72nd of an inch) from the origin.
Matrix
Matrix(doublena, doublenb, doublenc, doublend, doublenh, doublenv)Parameters
na: doubleThe horizontal scaling component (a).
nb: doubleThe vertical shearing component (b).
nc: doubleThe horizontal shearing component (c).
nd: doubleThe vertical scaling component (d).
nh: doubleThe horizontal translation component (h).
nv: doubleThe vertical translation component (v).
Construct a Matrix with the specified component values.
Member Function Documentation
DisposeChildren
voidDisposeChildren()Returns:
void[static initializer]
static void[static initializer]()concat
Parameters
Mt: MatrixThe matrix to concatenate (premultiply) onto this matrix.
Returns:
the transformed matrixConcatenate a matrix onto an existing matrix. The product returned is:
M' = Mt * M
This corresponds to the action of the cm operator.
delete
synchronized voiddelete(Booleandisposing)Parameters
disposing: Boolean
Returns:
synchronized voiddelete
synchronized voiddelete()Returns:
synchronized voidequals
booleanequals(Objectrhs)Parameters
rhs: Object
Returns:
booleanfinalize
voidfinalize()Returns:
voidgetA
doublegetA()Returns:
doubleThe horizontal scaling component of the matrix.
getB
doublegetB()Returns:
doubleThe vertical shearing component of the matrix.
getC
doublegetC()Returns:
doubleThe horizontal shearing component of the matrix.
getD
doublegetD()Returns:
doubleThe vertical scaling component of the matrix.
getH
doublegetH()Returns:
doubleThe horizontal translation component of the matrix.
getV
doublegetV()Returns:
doubleThe vertical translation component of the matrix.
invert
Matrixinvert()Returns:
The inverted matrix.Invert the Matrix object and return a new Matrix object.
multiply
Parameters
Returns:
the matrix product m1 x m2Multiply two transformation matrices.
rotate
Matrixrotate(doubleT)Parameters
T: doubleThe rotation, counterclockwise
Returns:
the result [cos T sin T -sin T 0 0] * MRotate a matrix by T degrees counterclockwise units. Rotation is done by creating the matrix [ cos T sin T -sin T cos T 0 0 ], and calling the Concat function with that matrix.
sameTypeEquals
booleansameTypeEquals(Matrixrhs)Parameters
rhs: Matrix
Returns:
booleanscale
Matrixscale(doublesx, doublesy)Parameters
sx: doubleX scaling factor
sy: doubleY scaling factor
Returns:
the result [sx 0 0 sy 0 0] * MScale a matrix by (sx,sy) units. Scaling is done by creating the matrix [sx 0 0 sy 0 0], and calling the Concat function with that matrix.
setA
voidsetA(doublevalue)Parameters
value: double
Returns:
voidThe horizontal scaling component of the matrix.
setB
voidsetB(doublevalue)Parameters
value: double
Returns:
voidThe vertical shearing component of the matrix.
setC
voidsetC(doublevalue)Parameters
value: double
Returns:
voidThe horizontal shearing component of the matrix.
setD
voidsetD(doublevalue)Parameters
value: double
Returns:
voidThe vertical scaling component of the matrix.
setH
voidsetH(doublevalue)Parameters
value: double
Returns:
voidThe horizontal translation component of the matrix.
setV
voidsetV(doublevalue)Parameters
value: double
Returns:
voidThe vertical translation component of the matrix.
toString
StringtoString()Returns:
A string describing this Matrix and its component values.Returns a string representation of this Matrix. The returned string contains all six matrix components (a, b, c, d, h, v) in a human-readable format.
translate
Matrixtranslate(doubletx, doublety)Parameters
tx: doubleX translation distance
ty: doubleY translation distance
Returns:
the result [1 0 0 1 tx ty] * MTranslate a matrix by (tx,ty) units. Translation is done by creating the matrix [ 1 0 0 1 tx ty ], and calling the Concat function with that matrix.