July 28, 2014
Represents a 3x3 affine transformation matrix used for transformations in two-dimensional space.
Assembly: System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.
Thetype exposes the following members.
|Identity||Gets an identity .|
|IsIdentity||Gets a value that indicates whether this structure is an identity matrix.|
|M11||Gets or sets the value of the first row and first column of this structure.|
|M12||Gets or sets the value of the first row and second column of this structure.|
|M21||Gets or sets the value of the second row and first column of this structure.|
|M22||Gets or sets the value of the second row and second column of this structure.|
|OffsetX||Gets or sets the value of the third row and first column of this structure.|
|OffsetY||Gets or sets the value of the third row and second column of this structure.|
|Equals(Matrix)||Determines whether the specified structure is identical to this instance.|
|Equals(Object)||Determines whether the specified Object is a structure that is identical to this . (Overrides ValueType.Equals(Object).)|
|Finalize||Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)|
|GetHashCode||Returns the hash code for this structure. (Overrides ValueType.GetHashCode().)|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|MemberwiseClone||Creates a shallow copy of the current Object. (Inherited from Object.)|
|ToString()||Creates a String representation of this structure. (Overrides ValueType.ToString().)|
|ToString(IFormatProvider)||Creates a String representation of this structure with culture-specific formatting information.|
|Transform||Transforms the specified point by the and returns the result.|
A 3x3 matrix is used for transformations in a two-dimensional 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 is stored using row-major order and has the following structure:
In methods and properties, the transformation matrix is usually specified as a vector with only six members, as follows:
Although you can use a structure directly to translate individual points, or with a MatrixTransform to transform objects, Windows Phone also provides a set of classes that enable you to transform objects without working directly with matrices: RotateTransform, ScaleTransform, SkewTransform, and TranslateTransform.
A provides the property value for the MatrixTransform.Matrix property.
In the XAML syntax, either a comma or space can be used as a delimiter.
The following XAML defines a that provides data for a MatrixTransform applied to a rectangular shape. In this case, the matrix combines an offset (OffsetX and OffsetY) and a skew (M12). Note that this same effect could have been produced by combining a TranslateTransform and a SkewTransform. Whether to use a single or combinations of discrete transforms is a matter of coding style, the results are identical.
<Rectangle Width="60" Height="60" Fill="Blue"> <Rectangle.RenderTransform> <MatrixTransform> <MatrixTransform.Matrix > <!-- This matrix transforms the x,y position of the rectangle and skews it. --> <Matrix OffsetX="30" OffsetY="100" M12="0.5" /> </MatrixTransform.Matrix> </MatrixTransform> </Rectangle.RenderTransform> </Rectangle>