FS_MATRIX for composing PDF user-space transformstype TPdfMatrix = class ... end;
| Type | Description |
|---|---|
TPdfPointArray | Dynamic array of FS_POINTF values used by bulk point operations |
TPdfRectArray | Dynamic array of FS_RECTF values used by bulk rectangle operations |
TPdfMatrixFitMode | pmfStretch, pmfContain, or pmfCover fitting policy for rectangle mapping |
TPdfMatrixDecomposition | Translation, signed scale, clockwise rotation, shear, determinant and reflection diagnostics returned by TryDecompose in the fields TranslationX, TranslationY, ScaleX, ScaleY, RotationDegrees, ShearDegrees, Determinant, and IsReflected |
| Member | Description |
|---|---|
Create | Create an identity matrix, a six-value matrix or a defensive copy from FS_MATRIX |
NewTranslation | Create a new translation matrix |
NewScale | Create a new non-uniform scale matrix |
NewRotation | Create a clockwise or anticlockwise rotation matrix in degrees or radians |
NewSkew | Create a matrix with separate X and Y shear angles |
NewRectMapping | Create a matrix that stretches, contains or covers a source rectangle within a destination rectangle |
TryCreateRectMapping | Return an FS_MATRIX mapping and reject zero-sized, non-finite or overflowing inputs without allocating an object |
Reset | Reset the matrix to identity |
SetElements | Replace all six matrix elements in one call |
Assign | Copy another TPdfMatrix or raw FS_MATRIX into this instance |
Clone | Create an independent object copy |
Determinant | Return the determinant of the linear 2 by 2 component |
IsFinite | Report whether every element is a finite Single value |
IsIdentity | Test identity using a caller-selectable tolerance |
IsInvertible | Test finite and scale-aware invertibility without computing an inverse |
IsTranslationOnly | Test whether the linear component is identity |
IsAxisAligned | Test whether rectangles remain axis aligned, including quarter-turn layouts within tolerance |
NearlyEquals | Compare against TPdfMatrix or FS_MATRIX using a tolerance |
GetTranslation | Read the X and Y translation elements together |
SetTranslation | Replace the X and Y translation whilst preserving the linear component |
ClearTranslation | Set both translation elements to zero |
TryDecompose | Extract translation, signed scale, clockwise rotation, shear, determinant and reflection state when the matrix is non-singular |
Multiply | Post-multiply by another TPdfMatrix or explicit a through f values |
PreMultiply | Pre-multiply by another TPdfMatrix or explicit six-value matrix |
PreTranslate | Prepend a translation in the matrix's local input space |
PreScale | Prepend separate X and Y scale factors |
PreRotate | Prepend a clockwise or anticlockwise rotation |
PreSkew | Prepend separate X and Y shear angles |
Translate | Append a translation by deltaX and deltaY |
Scale | Append separate X and Y scale factors |
Rotate | Append a clockwise or anticlockwise rotation in degrees or radians |
HorizontalFlip | Append an X-axis flip |
VerticalFlip | Append a Y-axis flip |
CentralFlip | Append both axis flips, equivalent to a 180-degree rotation without trigonometry |
Skew | Append separate X and Y shear angles |
RotateAt | Append a rotation around a pivot that remains fixed |
ScaleAt | Append a scale around a pivot that remains fixed |
SkewAt | Append a shear around a pivot that remains fixed |
HorizontalFlipAt | Append a horizontal flip around a caller-selected X coordinate |
VerticalFlipAt | Append a vertical flip around a caller-selected Y coordinate |
CentralFlipAt | Append both flips around a caller-selected pivot |
MapRectToRect | Append a stretch, contain, or cover mapping between normalised rectangles |
Invert | Replace the matrix with its inverse or raise EPdfMatrixError when it is singular |
TryInvert | Replace the matrix with its inverse and return False without mutation when it is singular or near-singular |
TryGetInverse | Calculate an inverse FS_MATRIX without mutating this instance |
InverseCopy | Create an independent inverse matrix or raise EPdfMatrixError when singular |
TransformPoint | Map a coordinate through the affine transform using the PDF row-vector convention |
TransformVector | Map a direction through only the linear component so translation is ignored |
TryInverseTransformPoint | Map a point through the inverse without allocating a matrix and report a singular transform as False |
InverseTransformPoint | Map a point through the inverse or raise EPdfMatrixError when singular |
TransformQuad | Map all four points of an FS_QUADPOINTSF value |
TransformPoints | Map a point array with one result allocation |
TransformPointsInPlace | Map a point array in caller-owned storage without allocating another array |
TryTransformBounds | Accumulate transformed point bounds in one pass and return False for empty input |
TransformBounds | Accumulate transformed point bounds in one pass or raise EPdfMatrixError for empty input |
TransformRect | Normalise and map a rectangle through an exact axis-aligned fast path or tight four-corner bounds |
TransformRects | Map a rectangle array with one result allocation |
TransformRectsInPlace | Map a rectangle array in caller-owned storage without allocating another array |
| Property | Type | Description |
|---|---|---|
a | Single | Read-only first matrix element |
b | Single | Read-only second matrix element |
c | Single | Read-only third matrix element |
d | Single | Read-only fourth matrix element |
e | Single | Read-only translation X element |
f | Single | Read-only translation Y element |
Handle | FS_MATRIX | Raw matrix value for PDFium APIs that accept FS_MATRIX or PFS_MATRIX |
TPdfMatrix uses the PDF affine layout a b c d e f and post-multiplies each operation, so calls read in the same order as the transforms applied to points
PreMultiply and the Pre* helpers add operations before the current transform, whilst the pivot helpers append translation-operation-translation sequences that keep the chosen pivot fixed
pmfContain preserves the complete source rectangle with centred unused space and pmfCover fills the destination with centred overflow, whilst pmfStretch allows independent X and Y scaling
Bulk point and rectangle methods allocate one output array, their in-place variants allocate none, and TryTransformBounds scans transformed points without constructing an intermediate array
Use Handle with APIs such as FPDFPageObj_SetMatrix, FPDFPageObj_Transform and FPDFText_SetMatrix
var
Matrix: TPdfMatrix;
begin
Matrix := TPdfMatrix.Create;
Matrix.ScaleAt(0.5, 0.5, 144, 144);
Matrix.RotateAt(15, 144, 144);
Matrix.Translate(72, 72);
FPDFPageObj_SetMatrix(ObjectHandle, @Matrix.Handle);
end;