Skip to main content
Skip table of contents

FMatrix and transforms


Objects on a PDF page get their size and position from a transformation matrix that is the sum of its own and those of the chain of parent nodes, up to the page root. These transformations are expressed in the form of a matrix. In Mako you can create matrices and apply them to objects to move, resize, or rotate content.

When you need to move, resize, or rotate content, you create an FMatrix and apply it with .setRenderTransform().

Creating an FMatrix

The FMatrix constructor can be used in three different ways:

1.FMatrix()Default. Use this to create a default matrix, then use the following methods to change individual values.
2.FMatrix(double xx, double xy, double yx, double yy, double dx, double dy);Specifies the full range of values.
3.FMatrix(FRect sourceRect, FRect destRect);This is a very useful constructor. It calculates a matrix for you based on source and destination rectangles, each expressed as an FRect (x,y origin and dX, dY dimensions).

The values (xx, xy, yx, yy, dx, and dy) are described below.

Setting values individually

The API documentation refers to a TItem, which is defined (via a typedef) as a double.

void setXX (TItem x)

Sets xx component.

void setXY (TItem x)

Sets xy component.

void setYX (TItem x)

Sets yx component.

void setYY (TItem x)

Sets yy component.

void setDX (TItem x)

Sets dx component.

void setDY (TItem x)

Sets dy component.

Matrix values

Matrix values and their effects are shown below:

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.