# Matrix Struct

## Definition

Represents a 3x3 affine transformation matrix used for transformations in 2-D space.

``public value class Matrix : IFormattable``
``````[System.ComponentModel.TypeConverter(typeof(System.Windows.Media.MatrixConverter))]
[System.Serializable]
public struct Matrix : IFormattable``````
``````type Matrix = struct
interface IFormattable``````
``````Public Structure Matrix
Implements IFormattable``````
Inheritance
Matrix
Attributes
Implements

## Remarks

A 3x3 matrix is used for transformations in a 2-D x-y plane. Affine transformation matrices can be multiplied to form any number of linear transformations, such as rotation and skew (shear), followed by translation. An affine transformation matrix has its final column equal to (0, 0, 1), so only the members in the first two columns need to be specified. Note that vectors are expressed as row-vectors, not column vectors.

A WPF Matrix is stored using row-major order and has the following structure:

M11 M12 0
M21 M22 0
OffsetX OffsetY 1

The members in the last row, OffsetX and OffsetY, represent translation values.

In methods and properties, the transformation matrix is usually specified as a vector with only six members, as follows:

(M11, M12, M21, M22, OffsetX, OffsetY)

Although you can use a Matrix structure directly to translate individual points, or with a MatrixTransform to transform objects, WPF also provides a set of classes that enable you to transform objects without working directly with matrices: RotateTransform, ScaleTransform, SkewTransform, and TranslateTransform.

### XAML Attribute Usage

``````<object property="m11, m12, m21, m22, offsetX, offsetY"/>
- or -
<object property="Identity"/>
``````

### XAML Values

The value in the first row and first column of this Matrix. For more information, see the M11 property.

The value in the first row and second column. For more information, see the M12 property.

The value in the second row and first column. For more information, see the M21 property.

The value in the second row and second column. For more information, see the M22 property.

offsetX
System.Double

The value in the third row and first column. For more information, see the OffsetX property.

offsetY
System.Double

The value in the third row and second column. For more information, see the OffsetY property.

## Constructors

 Initializes a new instance of the Matrix structure.

## Properties

 Gets the determinant of this Matrix structure. Gets a value that indicates whether this Matrix structure is invertible. Gets an identity Matrix. Gets a value that indicates whether this Matrix structure is an identity matrix. Gets or sets the value of the first row and first column of this Matrix structure. Gets or sets the value of the first row and second column of this Matrix structure. Gets or sets the value of the second row and first column of this Matrix structure. Gets or sets the value of the second row and second column of this Matrix structure. Gets or sets the value of the third row and first column of this Matrix structure. Gets or sets the value of the third row and second column of this Matrix structure.

## Methods

 Appends the specified Matrix structure to this Matrix structure. Determines whether the specified Matrix structure is identical to this instance. Determines whether the two specified Matrix structures are identical. Determines whether the specified Object is a Matrix structure that is identical to this Matrix. Returns the hash code for this Matrix structure. Inverts this Matrix structure. Multiplies a Matrix structure by another Matrix structure. Converts a String representation of a matrix into the equivalent Matrix structure. Prepends the specified Matrix structure onto this Matrix structure. Applies a rotation of the specified angle about the origin of this Matrix structure. Rotates this matrix about the specified point. Prepends a rotation of the specified angle at the specified point to this Matrix structure. Prepends a rotation of the specified angle to this Matrix structure. Appends the specified scale vector to this Matrix structure. Scales this Matrix by the specified amount about the specified point. Prepends the specified scale about the specified point of this Matrix. Prepends the specified scale vector to this Matrix structure. Changes this Matrix structure into an identity matrix. Appends a skew of the specified degrees in the x and y dimensions to this Matrix structure. Prepends a skew of the specified degrees in the x and y dimensions to this Matrix structure. Creates a String representation of this Matrix structure. Creates a String representation of this Matrix structure with culture-specific formatting information. Transforms the specified point by the Matrix and returns the result. Transforms the specified points by this Matrix. Transforms the specified vector by this Matrix. Transforms the specified vectors by this Matrix. Appends a translation of the specified offsets to this Matrix structure. Prepends a translation of the specified offsets to this Matrix structure.

## Operators

 Determines whether the two specified Matrix structures are identical. Determines whether the two specified Matrix structures are not identical. Multiplies a Matrix structure by another Matrix structure.

## Explicit Interface Implementations

 Formats the value of the current instance using the specified format.