Matrix Struct
Definition
A 3x3 matrix.
public struct Matrix
Remarks
Matrix layout: | 1st col | 2nd col | 3r col | 1st row | scaleX | skewY | perspX | 2nd row | skewX | scaleY | perspY | 3rd row | transX | transY | perspZ |
Note: Skia.SkMatrix uses a transposed layout (where for example skewX/skewY and persp0/transX are swapped).
Constructors
| Name | Description |
|---|---|
| Matrix (2 overloads) | Initializes a new instance of the Avalonia.Matrix struct (equivalent to a 2x3 Matrix without perspective). |
Matrix overloads
Matrix Constructor
Initializes a new instance of the Avalonia.Matrix struct (equivalent to a 2x3 Matrix without perspective).
public Matrix(double scaleX, double skewY, double skewX, double scaleY, double offsetX, double offsetY)
Parameters
scaleX double
The first element of the first row.
skewY double
The second element of the first row.
skewX double
The first element of the second row.
scaleY double
The second element of the second row.
offsetX double
The first element of the third row.
offsetY double
The second element of the third row.
Matrix Constructor
Initializes a new instance of the Avalonia.Matrix struct.
public Matrix(double scaleX, double skewY, double perspX, double skewX, double scaleY, double perspY, double offsetX, double offsetY, double perspZ)
Parameters
scaleX double
The first element of the first row.
skewY double
The second element of the first row.
perspX double
The third element of the first row.
skewX double
The first element of the second row.
scaleY double
The second element of the second row.
perspY double
The third element of the second row.
offsetX double
The first element of the third row.
offsetY double
The second element of the third row.
perspZ double
The third element of the third row.
Methods
| Name | Description |
|---|---|
| Append | Appends another matrix as post-multiplication operation. Equivalent to this * value; |
| ContainsPerspective | Determines if the current matrix contains perspective (non-affine) transforms (true) or only (affine) transforms that could be mapped into an 2x3 matrix (false). |
| CreateRotation (2 overloads) | Creates a rotation matrix using the given rotation in radians. |
| CreateScale (2 overloads) | Creates a scale matrix from the given vector scale. |
| CreateSkew | Creates a skew matrix from the given axis skew angles in radians. |
| CreateTranslation (2 overloads) | Creates a translation matrix from the given vector. |
| Equals (2 overloads) | Returns a boolean indicating whether the matrix is equal to the other given matrix. |
| GetDeterminant | Calculates the determinant for this matrix. |
| GetHashCode | Returns the hash code for this instance. |
| Invert | Inverts the Matrix. |
| Parse | Parses a Avalonia.Matrix string. |
| Prepend | Prepends another matrix as pre-multiplication operation. Equivalent to value * this; |
| ToRadians | Converts an angle in degrees to radians. |
| ToString | Returns a String representing this matrix instance. |
| Transform | Transforms the point with the matrix |
| TryDecomposeTransform | No summary available. |
| TryInvert | No summary available. |
Append Method
Appends another matrix as post-multiplication operation. Equivalent to this * value;
public Avalonia.Matrix Append(Avalonia.Matrix value)
Parameters
value Avalonia.Matrix
A matrix.
Returns
Post-multiplied matrix.
ContainsPerspective Method
Determines if the current matrix contains perspective (non-affine) transforms (true) or only (affine) transforms that could be mapped into an 2x3 matrix (false).
public bool ContainsPerspective()
Returns
bool
CreateRotation overloads
CreateRotation Method
Creates a rotation matrix using the given rotation in radians.
public Avalonia.Matrix CreateRotation(double radians)
Parameters
radians double
The amount of rotation, in radians.
Returns
A rotation matrix.
CreateRotation Method
Creates a rotation matrix using the given rotation in radians around center point.
public Avalonia.Matrix CreateRotation(double radians, Avalonia.Point center)
Parameters
radians double
The amount of rotation, in radians.
center Avalonia.Point
The location of center point.
Returns
CreateScale overloads
CreateScale Method
Creates a scale matrix from the given vector scale.
public Avalonia.Matrix CreateScale(Avalonia.Vector scales)
Parameters
scales Avalonia.Vector
The scale to use.
Returns
A scaling matrix.
CreateScale Method
Creates a scale matrix from the given X and Y components.
public Avalonia.Matrix CreateScale(double xScale, double yScale)
Parameters
xScale double
Value to scale by on the X-axis.
yScale double
Value to scale by on the Y-axis.
Returns
A scaling matrix.
CreateSkew Method
Creates a skew matrix from the given axis skew angles in radians.
public Avalonia.Matrix CreateSkew(double xAngle, double yAngle)