Matrix
Overview
Matrix is a class in Aspose.PDF FOSS for .NET.
Represents a 3x3 transformation matrix [a b 0; c d 0; e f 1].
This class provides 30 methods for working with Matrix objects in .NET programs.
Available methods include: Add, Equals, GetAngle, GetFlipMatrix, GetHashCode, Inverse, InverseTransformPoint, Matrix, Multiply, Reverse, Rotate, Rotation, and 8 additional methods.
All public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package.
Properties: A, B, C, D, Data, E, and 3 more.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
A | double | Read/Write | Gets or sets the a. |
B | double | Read/Write | Gets or sets the b. |
C | double | Read/Write | Gets or sets the c. |
D | double | Read/Write | Gets or sets the d. |
E | double | Read/Write | Gets or sets the e. |
F | double | Read/Write | Gets or sets the f. |
Data | double[] | Read | The matrix elements as a 6-element double array. |
Elements | float[] | Read | The matrix elements as a 6-element float array. |
Identity | Matrix | Read | Identity matrix. |
Methods
| Signature | Description |
|---|---|
Matrix() | Default constructor — produces the identity matrix. |
Matrix(a: double, b: double, c: double, d: double, e: double, f: double) | Calls Matrix on this Matrix instance. |
Matrix(matrix: Matrix) | Copy constructor. |
Matrix(matrixArray: double[]) | Create a matrix from a 6-element array [a, b, c, d, e, f]. |
Matrix(matrixArray: float[]) | Create a matrix from a 6-element float array. |
Translate(tx: double, ty: double) | Create a translation matrix. |
Scale(sx: double, sy: double) | Create a scaling matrix. |
Rotate(degrees: double) | Create a rotation matrix (angle in degrees). |
Translate(dx: double, dy: double, source: Matrix) | Compose a translation onto source: returns source × translate(dx, dy). |
Scale(sx: double, sy: double, source: Matrix) | Compose a scaling onto source: returns source × scale(sx, sy). |
Rotation(alpha: double) | Create a rotation matrix; alpha is in radians. |
Rotation(rotation: Rotation) | Create a rotation matrix for one of the four standard PDF rotations. |
Skew(alpha: double, beta: double) | Create a skew/shear matrix; alpha and beta are in radians. |
GetAngle(rotation: Rotation) | Convert a Rotation value to its angle in radians. |
GetFlipMatrix() | A matrix that flips the Y axis (vertical mirror). |
Add(other: Matrix) | Element-wise addition. |
Multiply(other: Matrix) | Multiply this matrix by another: this × other. |
TransformPoint(x: double, y: double) | Transform a point (returns the result via tuple — convenience). |
Transform(x: double, y: double, x1: double, y1: double) | Transform a point and return the result via out parameters. |
InverseTransformPoint(x: double, y: double) | Transform a point by the inverse of this matrix (returns the result via tuple). |
UnTransform(x1: double, y1: double, x: double, y: double) | Inverse-transform a point and return the result via out parameters. |
Scale(x: double, y: double, x1: double, y1: double) | Apply only the scale portion of this matrix (drops the translation component). |
UnScale(x1: double, y1: double, x: double, y: double) | Apply the inverse scale (drops translation). |
Inverse() | Compute the inverse matrix. |
Reverse() | Calculates reverse (inverse) matrix. |
Transform(p: Point) | Transform a point. |
Transform(rect: Rectangle) | Transform a rectangle. |
Equals(obj: object?) | Calls Equals on this Matrix instance. |
GetHashCode() | Calls GetHashCode on this Matrix instance. |
ToString() | Calls ToString on this Matrix instance. |