Matrix Class Documentation

class Matrix

Namespace: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.

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(double na, double nb, double nc, double nd, double nh, double nv)

Parameters

na: double
nb: double
nc: double
nd: double
nh: double
nv: double

Member Function Documentation

concat

Matrix concat(Matrix Mt)

Parameters

Mt: Matrix

Returns:

Matrix

the transformed matrix

Concatenate a matrix onto an existing matrix. The product returned is:

M' = Mt * M

This corresponds to the action of the cm operator.

delete

synchronized void delete(Boolean disposing)

Parameters

disposing: Boolean

Returns:

synchronized void

delete

synchronized void delete()

Returns:

synchronized void

equals

boolean equals(Object rhs)

Parameters

rhs: Object

Returns:

boolean

finalize

void finalize()

Returns:

void

getA

double getA()

Returns:

double

getB

double getB()

Returns:

double

getC

double getC()

Returns:

double

getD

double getD()

Returns:

double

getH

double getH()

Returns:

double

getV

double getV()

Returns:

double

invert

Matrix invert()

Returns:

Matrix

Invert the Matrix object and return a new Matrix object.

rotate

Matrix rotate(double T)

Parameters

T: double

The rotation, counterclockwise

Returns:

Matrix

the result [cos T sin T -sin T 0 0] * M

Rotate 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.

scale

Matrix scale(double sx, double sy)

Parameters

sx: double

X scaling factor

sy: double

Y scaling factor

Returns:

Matrix

the result [sx 0 0 sy 0 0] * M

Scale 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

void setA(double value)

Parameters

value: double

Returns:

void

setB

void setB(double value)

Parameters

value: double

Returns:

void

setC

void setC(double value)

Parameters

value: double

Returns:

void

setD

void setD(double value)

Parameters

value: double

Returns:

void

setH

void setH(double value)

Parameters

value: double

Returns:

void

setV

void setV(double value)

Parameters

value: double

Returns:

void

toString

String toString()

Returns:

String

translate

Matrix translate(double tx, double ty)

Parameters

tx: double

X translation distance

ty: double

Y translation distance

Returns:

Matrix

the result [1 0 0 1 tx ty] * M

Translate 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.