Table of Contents

Struct XMatrix

Namespace
PdfSharp.Drawing
Assembly
PdfSharp.dll

Represents a 3-by-3 matrix that represents an affine 2D transformation.

public struct XMatrix : IFormattable
Implements
Inherited Members

Constructors

XMatrix(double, double, double, double, double, double)

Initializes a new instance of the XMatrix struct.

public XMatrix(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 of this matrix.

public double Determinant { get; }

Property Value

double

HasInverse

Gets a value that indicates whether this matrix is invertible.

public bool HasInverse { get; }

Property Value

bool

Identity

Gets the identity matrix.

public static XMatrix Identity { get; }

Property Value

XMatrix

IsIdentity

Gets a value indicating whether this matrix instance is the identity matrix.

public bool IsIdentity { get; }

Property Value

bool

M11

Gets or sets the value of the first row and first column of this matrix.

public double M11 { get; set; }

Property Value

double

M12

Gets or sets the value of the first row and second column of this matrix.

public double M12 { get; set; }

Property Value

double

M21

Gets or sets the value of the second row and first column of this matrix.

public double M21 { get; set; }

Property Value

double

M22

Gets or sets the value of the second row and second column of this matrix.

public double M22 { get; set; }

Property Value

double

OffsetX

Gets or sets the value of the third row and first column of this matrix.

public double OffsetX { get; set; }

Property Value

double

OffsetY

Gets or sets the value of the third row and second column of this matrix.

public double OffsetY { get; set; }

Property Value

double

Methods

Append(XMatrix)

Appends the specified matrix to this matrix.

public void Append(XMatrix matrix)

Parameters

matrix XMatrix

Equals(XMatrix)

Determines whether this matrix is equal to the specified matrix.

public bool Equals(XMatrix value)

Parameters

value XMatrix

Returns

bool

Equals(XMatrix, XMatrix)

Determines whether the two matrices are equal.

public static bool Equals(XMatrix matrix1, XMatrix matrix2)

Parameters

matrix1 XMatrix
matrix2 XMatrix

Returns

bool

Equals(object?)

Determines whether this matrix is equal to the specified object.

public override bool Equals(object? o)

Parameters

o object

Returns

bool

GetElements()

Gets an array of double values that represents the elements of this matrix.

public double[] GetElements()

Returns

double[]

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

Invert()

Inverts the matrix.

public void Invert()

Multiply(XMatrix)

Appends the specified matrix to this matrix.

[Obsolete("Use Append.")]
public void Multiply(XMatrix matrix)

Parameters

matrix XMatrix

Multiply(XMatrix, XMatrix)

Multiplies two matrices.

public static XMatrix Multiply(XMatrix trans1, XMatrix trans2)

Parameters

trans1 XMatrix
trans2 XMatrix

Returns

XMatrix

Multiply(XMatrix, XMatrixOrder)

Multiplies this matrix with the specified matrix.

public void Multiply(XMatrix matrix, XMatrixOrder order)

Parameters

matrix XMatrix
order XMatrixOrder

MultiplyPrepend(XMatrix)

Prepends the specified matrix to this matrix.

[Obsolete("Use Prepend.")]
public void MultiplyPrepend(XMatrix matrix)

Parameters

matrix XMatrix

Parse(string)

Parses a matrix from a string.

public static XMatrix Parse(string source)

Parameters

source string

Returns

XMatrix

Prepend(XMatrix)

Prepends the specified matrix to this matrix.

public void Prepend(XMatrix matrix)

Parameters

matrix XMatrix

Rotate(double)

Function is obsolete.

[Obsolete("Use RotateAppend or RotatePrepend explicitly, because in GDI+ and WPF the defaults are contrary.", true)]
public void Rotate(double angle)

Parameters

angle double

Rotate(double, XMatrixOrder)

Rotates the matrix with the specified angle.

public void Rotate(double angle, XMatrixOrder order)

Parameters

angle double
order XMatrixOrder

RotateAppend(double)

Appends a rotation of the specified angle to this matrix.

public void RotateAppend(double angle)

Parameters

angle double

RotateAt(double, XPoint)

Rotates the matrix with the specified angle at the specified point.

[Obsolete("Use RotateAtAppend or RotateAtPrepend explicitly, because in GDI+ and WPF the defaults are contrary.", true)]
public void RotateAt(double angle, XPoint point)

Parameters

angle double
point XPoint

RotateAt(double, XPoint, XMatrixOrder)

Rotates the matrix with the specified angle at the specified point.

public void RotateAt(double angle, XPoint point, XMatrixOrder order)

Parameters

angle double
point XPoint
order XMatrixOrder

RotateAt(double, double, double)

Function is obsolete.

[Obsolete("Use RotateAtAppend or RotateAtPrepend explicitly, because in GDI+ and WPF the defaults are contrary.", true)]
public void RotateAt(double angle, double centerX, double centerY)

Parameters

angle double
centerX double
centerY double

RotateAtAppend(double, XPoint)

Appends a rotation of the specified angle at the specified point to this matrix.

public void RotateAtAppend(double angle, XPoint point)

Parameters

angle double
point XPoint

RotateAtAppend(double, double, double)

Appends a rotation of the specified angle at the specified point to this matrix.

public void RotateAtAppend(double angle, double centerX, double centerY)

Parameters

angle double
centerX double
centerY double

RotateAtPrepend(double, XPoint)

Prepends a rotation of the specified angle at the specified point to this matrix.

public void RotateAtPrepend(double angle, XPoint point)

Parameters

angle double
point XPoint

RotateAtPrepend(double, double, double)

Prepends a rotation of the specified angle at the specified point to this matrix.

public void RotateAtPrepend(double angle, double centerX, double centerY)

Parameters

angle double
centerX double
centerY double

RotatePrepend(double)

Prepends a rotation of the specified angle to this matrix.

public void RotatePrepend(double angle)

Parameters

angle double

Scale(double)

Scales the matrix with the specified scalar.

[Obsolete("Use ScaleAppend or ScalePrepend explicitly, because in GDI+ and WPF the defaults are contrary.", true)]
public void Scale(double scaleXY)

Parameters

scaleXY double

Scale(double, XMatrixOrder)

Scales the matrix with the specified scalar.

public void Scale(double scaleXY, XMatrixOrder order)

Parameters

scaleXY double
order XMatrixOrder

Scale(double, double)

Appends the specified scale vector to this matrix.

[Obsolete("Use ScaleAppend or ScalePrepend explicitly, because in GDI+ and WPF the defaults are contrary.", true)]
public void Scale(double scaleX, double scaleY)

Parameters

scaleX double
scaleY double

Scale(double, double, XMatrixOrder)

Scales the matrix with the specified scalars.

public void Scale(double scaleX, double scaleY, XMatrixOrder order)

Parameters

scaleX double
scaleY double
order XMatrixOrder

ScaleAppend(double)

Appends the specified scale vector to this matrix.

public void ScaleAppend(double scaleXY)

Parameters

scaleXY double

ScaleAppend(double, double)

Appends the specified scale vector to this matrix.

public void ScaleAppend(double scaleX, double scaleY)

Parameters

scaleX double
scaleY double

ScaleAt(double, double, double, double)

Function is obsolete.

[Obsolete("Use ScaleAtAppend or ScaleAtPrepend explicitly, because in GDI+ and WPF the defaults are contrary.", true)]
public void ScaleAt(double scaleX, double scaleY, double centerX, double centerY)

Parameters

scaleX double
scaleY double
centerX double
centerY double

ScaleAtAppend(double, double, double, double)

Appends the specified scale about the specified point of this matrix.

public void ScaleAtAppend(double scaleX, double scaleY, double centerX, double centerY)

Parameters

scaleX double
scaleY double
centerX double
centerY double

ScaleAtPrepend(double, double, double, double)

Prepends the specified scale about the specified point of this matrix.

public void ScaleAtPrepend(double scaleX, double scaleY, double centerX, double centerY)

Parameters

scaleX double
scaleY double
centerX double
centerY double

ScalePrepend(double)

Prepends the specified scale vector to this matrix.

public void ScalePrepend(double scaleXY)

Parameters

scaleXY double

ScalePrepend(double, double)

Prepends the specified scale vector to this matrix.

public void ScalePrepend(double scaleX, double scaleY)

Parameters

scaleX double
scaleY double

SetIdentity()

Sets this matrix into an identity matrix.

public void SetIdentity()

Shear(double, double)

Function is obsolete.

[Obsolete("Use ShearAppend or ShearPrepend explicitly, because in GDI+ and WPF the defaults are contrary.", true)]
public void Shear(double shearX, double shearY)

Parameters

shearX double
shearY double

Shear(double, double, XMatrixOrder)

Shears the matrix with the specified scalars.

public void Shear(double shearX, double shearY, XMatrixOrder order)

Parameters

shearX double
shearY double
order XMatrixOrder

ShearAppend(double, double)

Appends a skew of the specified degrees in the x and y dimensions to this matrix.

public void ShearAppend(double shearX, double shearY)

Parameters

shearX double
shearY double

ShearPrepend(double, double)

Prepends a skew of the specified degrees in the x and y dimensions to this matrix.

public void ShearPrepend(double shearX, double shearY)

Parameters

shearX double
shearY double

Skew(double, double)

Function is obsolete.

[Obsolete("Use SkewAppend or SkewPrepend explicitly, because in GDI+ and WPF the defaults are contrary.", true)]
public void Skew(double skewX, double skewY)

Parameters

skewX double
skewY double

SkewAppend(double, double)

Appends a skew of the specified degrees in the x and y dimensions to this matrix.

public void SkewAppend(double skewX, double skewY)

Parameters

skewX double
skewY double

SkewPrepend(double, double)

Prepends a skew of the specified degrees in the x and y dimensions to this matrix.

public void SkewPrepend(double skewX, double skewY)

Parameters

skewX double
skewY double

ToString()

Converts this XMatrix to a human readable string.

public override string ToString()

Returns

string

ToString(IFormatProvider)

Converts this XMatrix to a human readable string.

public string ToString(IFormatProvider provider)

Parameters

provider IFormatProvider

Returns

string

Transform(XPoint)

Transforms the specified point by this matrix and returns the result.

public XPoint Transform(XPoint point)

Parameters

point XPoint

Returns

XPoint

Transform(XPoint[])

Transforms the specified points by this matrix.

public void Transform(XPoint[] points)

Parameters

points XPoint[]

Transform(XVector)

Transforms the specified vector by this Matrix and returns the result.

public XVector Transform(XVector vector)

Parameters

vector XVector

Returns

XVector

Transform(XVector[])

Transforms the specified vectors by this matrix.

public void Transform(XVector[] vectors)

Parameters

vectors XVector[]

TransformPoints(XPoint[])

Multiplies all points of the specified array with this matrix.

public void TransformPoints(XPoint[] points)

Parameters

points XPoint[]

Translate(double, double)

Appends a translation of the specified offsets to this matrix.

[Obsolete("Use TranslateAppend or TranslatePrepend explicitly, because in GDI+ and WPF the defaults are contrary.", true)]
public void Translate(double offsetX, double offsetY)

Parameters

offsetX double
offsetY double

Translate(double, double, XMatrixOrder)

Translates the matrix with the specified offsets.

public void Translate(double offsetX, double offsetY, XMatrixOrder order)

Parameters

offsetX double
offsetY double
order XMatrixOrder

TranslateAppend(double, double)

Appends a translation of the specified offsets to this matrix.

public void TranslateAppend(double offsetX, double offsetY)

Parameters

offsetX double
offsetY double

TranslatePrepend(double, double)

Prepends a translation of the specified offsets to this matrix.

public void TranslatePrepend(double offsetX, double offsetY)

Parameters

offsetX double
offsetY double

Operators

operator ==(XMatrix, XMatrix)

Determines whether the two matrices are equal.

public static bool operator ==(XMatrix matrix1, XMatrix matrix2)

Parameters

matrix1 XMatrix
matrix2 XMatrix

Returns

bool

operator !=(XMatrix, XMatrix)

Determines whether the two matrices are not equal.

public static bool operator !=(XMatrix matrix1, XMatrix matrix2)

Parameters

matrix1 XMatrix
matrix2 XMatrix

Returns

bool

operator *(XMatrix, XMatrix)

Multiplies two matrices.

public static XMatrix operator *(XMatrix trans1, XMatrix trans2)

Parameters

trans1 XMatrix
trans2 XMatrix

Returns

XMatrix