Struct XMatrix
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
Properties
Determinant
Gets the determinant of this matrix.
public double Determinant { get; }
Property Value
HasInverse
Gets a value that indicates whether this matrix is invertible.
public bool HasInverse { get; }
Property Value
Identity
Gets the identity matrix.
public static XMatrix Identity { get; }
Property Value
IsIdentity
Gets a value indicating whether this matrix instance is the identity matrix.
public bool IsIdentity { get; }
Property Value
M11
Gets or sets the value of the first row and first column of this matrix.
public double M11 { get; set; }
Property Value
M12
Gets or sets the value of the first row and second column of this matrix.
public double M12 { get; set; }
Property Value
M21
Gets or sets the value of the second row and first column of this matrix.
public double M21 { get; set; }
Property Value
M22
Gets or sets the value of the second row and second column of this matrix.
public double M22 { get; set; }
Property Value
OffsetX
Gets or sets the value of the third row and first column of this matrix.
public double OffsetX { get; set; }
Property Value
OffsetY
Gets or sets the value of the third row and second column of this matrix.
public double OffsetY { get; set; }
Property Value
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
Equals(XMatrix, XMatrix)
Determines whether the two matrices are equal.
public static bool Equals(XMatrix matrix1, XMatrix matrix2)
Parameters
Returns
Equals(object?)
Determines whether this matrix is equal to the specified object.
public override bool Equals(object? o)
Parameters
o
object
Returns
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
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
Returns
Multiply(XMatrix, XMatrixOrder)
Multiplies this matrix with the specified matrix.
public void Multiply(XMatrix matrix, XMatrixOrder order)
Parameters
matrix
XMatrixorder
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
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
doubleorder
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
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
doublepoint
XPointorder
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
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
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
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
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
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
doubleorder
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
Scale(double, double, XMatrixOrder)
Scales the matrix with the specified scalars.
public void Scale(double scaleX, double scaleY, XMatrixOrder order)
Parameters
scaleX
doublescaleY
doubleorder
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
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
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
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
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
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
Shear(double, double, XMatrixOrder)
Shears the matrix with the specified scalars.
public void Shear(double shearX, double shearY, XMatrixOrder order)
Parameters
shearX
doubleshearY
doubleorder
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
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
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
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
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
ToString()
Converts this XMatrix to a human readable string.
public override string ToString()
Returns
ToString(IFormatProvider)
Converts this XMatrix to a human readable string.
public string ToString(IFormatProvider provider)
Parameters
provider
IFormatProvider
Returns
Transform(XPoint)
Transforms the specified point by this matrix and returns the result.
public XPoint Transform(XPoint point)
Parameters
point
XPoint
Returns
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
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
Translate(double, double, XMatrixOrder)
Translates the matrix with the specified offsets.
public void Translate(double offsetX, double offsetY, XMatrixOrder order)
Parameters
offsetX
doubleoffsetY
doubleorder
XMatrixOrder
TranslateAppend(double, double)
Appends a translation of the specified offsets to this matrix.
public void TranslateAppend(double offsetX, double offsetY)
Parameters
TranslatePrepend(double, double)
Prepends a translation of the specified offsets to this matrix.
public void TranslatePrepend(double offsetX, double offsetY)
Parameters
Operators
operator ==(XMatrix, XMatrix)
Determines whether the two matrices are equal.
public static bool operator ==(XMatrix matrix1, XMatrix matrix2)
Parameters
Returns
operator !=(XMatrix, XMatrix)
Determines whether the two matrices are not equal.
public static bool operator !=(XMatrix matrix1, XMatrix matrix2)
Parameters
Returns
operator *(XMatrix, XMatrix)
Multiplies two matrices.
public static XMatrix operator *(XMatrix trans1, XMatrix trans2)