Struct
Matrix

3x3 affine transform matrix for 2D operations (scale, rotate, skew, translate) used in rendering.

Definition

Namespace:Telerik.Documents.Primitives

Assembly:Telerik.Windows.Documents.Core.dll

Syntax:

cs-api-definition
public struct Matrix

Constructors

Matrix(double, double, double, double, double, double)

Initializes a new instance of the Matrix struct. m11, m12, 0 m21, m22, 0 offsetX, offsetY, 1

Declaration

cs-api-definition
public Matrix(double m11, double m12, double m21, double m22, double offsetX, double offsetY)

Parameters

m11

double

m12

double

m21

double

m22

double

offsetX

double

offsetY

double

Properties

Determinant

Gets the determinant, which is zero for non-invertible matrices.

Declaration

cs-api-definition
public double Determinant { get; }

Property Value

double

HasInverse

Gets a value indicating whether this Matrix is invertible.

Declaration

cs-api-definition
public bool HasInverse { get; }

Property Value

bool

Identity

Gets an identity matrix.

Declaration

cs-api-definition
public static Matrix Identity { get; }

Property Value

Matrix

IsIdentity

Gets a value indicating whether this Matrix equals the identity transform.

Declaration

cs-api-definition
public bool IsIdentity { get; }

Property Value

bool

M11

Gets or sets the M11 value.

Declaration

cs-api-definition
public double M11 { get; set; }

Property Value

double

M12

Gets or sets the M12 value.

Declaration

cs-api-definition
public double M12 { get; set; }

Property Value

double

M21

Gets or sets the M21 value.

Declaration

cs-api-definition
public double M21 { get; set; }

Property Value

double

M22

Gets or sets the M22 value.

Declaration

cs-api-definition
public double M22 { get; set; }

Property Value

double

OffsetX

Gets or sets the translation on the X axis (OffsetX).

Declaration

cs-api-definition
public double OffsetX { get; set; }

Property Value

double

OffsetY

Gets or sets the translation on the Y axis (OffsetY).

Declaration

cs-api-definition
public double OffsetY { get; set; }

Property Value

double

Methods

Equals(object)

Determines whether the specified object is equal to the current Matrix.

Declaration

cs-api-definition
public override bool Equals(object obj)

Parameters

obj

object

The object to compare with the current instance.

Returns

bool

True if the specified object is a Matrix whose elements and offsets equal those of this instance; otherwise, false.

Overrides ValueType.Equals(object)

GetHashCode()

Returns a hash code for the current Matrix.

Declaration

cs-api-definition
public override int GetHashCode()

Returns

int

A hash code computed from the matrix elements; returns 0 for the identity matrix.

Overrides ValueType.GetHashCode()

Rotate(double, double, double)

Rotates this Matrix at the given point.

Declaration

cs-api-definition
public Matrix Rotate(double angle, double centerX = 0, double centerY = 0)

Parameters

angle

double

The angle to rotate.

centerX

double

The centerX of rotation. Default 0.

centerY

double

The centerY of rotation. Default 0.

Returns

Matrix

Scale(double, double, double, double)

Scales this Matrix around the origin.

Declaration

cs-api-definition
public Matrix Scale(double scaleX, double scaleY, double centerX = 0, double centerY = 0)

Parameters

scaleX

double

The scale factor in the x dimension.

scaleY

double

The scale factor in the y dimension.

centerX

double

The centerX of scale. Default 0.

centerY

double

The centerY of scale. Default 0.

Returns

Matrix

ScalePrepend(double, double, double, double)

Prepends a scale around the origin to this Matrix.

Declaration

cs-api-definition
public Matrix ScalePrepend(double scaleX, double scaleY, double centerX = 0, double centerY = 0)

Parameters

scaleX

double

The scale factor in the x dimension.

scaleY

double

The scale factor in the y dimension.

centerX

double

The centerX of scale. Default 0.

centerY

double

The centerY of scale. Default 0.

Returns

Matrix

Shear(float, float)

Shears the matrix with the specified scalars.

Declaration

cs-api-definition
public void Shear(float shearX, float shearY)

Parameters

shearX

float

shearY

float

ShearPrepend(double, double)

Shears the matrix with the specified scalars.

Declaration

cs-api-definition
public void ShearPrepend(double shearX, double shearY)

Parameters

shearX

double

shearY

double

ToString()

Returns a string that represents the current Matrix.

Declaration

cs-api-definition
public override string ToString()

Returns

string

A string containing the matrix elements in row-major order.

Overrides ValueType.ToString()

Translate(double, double)

Translates this Matrix.

Declaration

cs-api-definition
public Matrix Translate(double offsetX, double offsetY)

Parameters

offsetX

double

The offset in the x dimension.

offsetY

double

The offset in the y dimension.

Returns

Matrix

Operators

operator !=(Matrix, Matrix)

Compares two Matrix instances for exact inequality.

Declaration

cs-api-definition
public static bool operator !=(Matrix a, Matrix b)

Parameters

a

Matrix

The first Matrix to compare.

b

Matrix

The second Matrix to compare.

Returns

bool

True if the two Matrixs are exactly unequal; otherwise false.

operator *(Matrix, Matrix)

Returns a new instance of Matrix that is the result of the multiplication if matrix1 and matrix2.

Declaration

cs-api-definition
public static Matrix operator *(Matrix matrix1, Matrix matrix2)

Parameters

matrix1

Matrix

The left matrix to multiply.

matrix2

Matrix

The right matrix to multiply.

Returns

Matrix

operator ==(Matrix, Matrix)

Compares two Matrix instances for exact equality.

Declaration

cs-api-definition
public static bool operator ==(Matrix a, Matrix b)

Parameters

a

Matrix

The first Matrix to compare.

b

Matrix

The second Matrix to compare.

Returns

bool

True if the two Matrixs are exactly equal; otherwise false.