Matrix Matrix Matrix Matrix Struct

定义

表示用于在二维空间中进行转换的 3x3 仿射转换矩阵。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
继承
属性
实现

注解

3x3 矩阵用于二维2-D x-y 平面中的变换。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. 仿射转换矩阵的最终列等于 (0, 0, 1), 因此只需指定前两列中的成员。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.

使用行优先顺序进行存储, 其结构如下: Matrix WPFWPFA WPFWPF Matrix is stored using row-major order and has the following structure:

M11 M12 00
M21 M22 00
OffsetX OffsetY 11

最后一行OffsetX OffsetY中的成员表示转换值。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)(M11, M12, M21, M22, OffsetX, OffsetY)

虽然你可以直接使用Matrix结构来转换各个点, 或者MatrixTransform可以使用来转换对象, WPFWPF但还提供了一组类, 使你能够转换对象, 而无需直接使用矩阵:RotateTransform、 、ScaleTransformTranslateTransformSkewTransformAlthough you can use a Matrix structure directly to translate individual points, or with a MatrixTransform to transform objects, WPFWPF also provides a set of classes that enable you to transform objects without working directly with matrices: RotateTransform, ScaleTransform, SkewTransform, and TranslateTransform.

XAML 属性用法XAML Attribute Usage

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

XAML 值XAML Values

m11m11
System.Double

Matrix中第一行、第一列中的值。The value in the first row and first column of this Matrix. 有关更多信息,请参见 M11 属性。For more information, see the M11 property.

m12m12
System.Double

第一行和第二列中的值。The value in the first row and second column. 有关更多信息,请参见 M12 属性。For more information, see the M12 property.

m21m21
System.Double

第二行和第一列中的值。The value in the second row and first column. 有关更多信息,请参见 M21 属性。For more information, see the M21 property.

m22m22
System.Double

第二行和第二列中的值。The value in the second row and second column. 有关更多信息,请参见 M22 属性。For more information, see the M22 property.

offsetXoffsetX
System.Double

第三行和第一列中的值。The value in the third row and first column. 有关更多信息,请参见 OffsetX 属性。For more information, see the OffsetX property.

offsetYoffsetY
System.Double

第三行和第二列中的值。The value in the third row and second column. 有关更多信息,请参见 OffsetY 属性。For more information, see the OffsetY property.

构造函数

Matrix(Double, Double, Double, Double, Double, Double) Matrix(Double, Double, Double, Double, Double, Double) Matrix(Double, Double, Double, Double, Double, Double) Matrix(Double, Double, Double, Double, Double, Double)

初始化 Matrix 结构的新实例。Initializes a new instance of the Matrix structure.

属性

Determinant Determinant Determinant Determinant

获取此 Matrix 结构的行列式。Gets the determinant of this Matrix structure.

HasInverse HasInverse HasInverse HasInverse

获取一个值,该值指示此 Matrix 结构是否可以反转。Gets a value that indicates whether this Matrix structure is invertible.

Identity Identity Identity Identity

获取一个恒等 MatrixGets an identity Matrix.

IsIdentity IsIdentity IsIdentity IsIdentity

获取一个值,该值指示此 Matrix 结构是否为恒等矩阵。Gets a value that indicates whether this Matrix structure is an identity matrix.

M11 M11 M11 M11

获取或设置此 Matrix 结构中第一行与第一列相交处的值。Gets or sets the value of the first row and first column of this Matrix structure.

M12 M12 M12 M12

获取或设置此 Matrix 结构中第一行与第二列相交处的值。Gets or sets the value of the first row and second column of this Matrix structure.

M21 M21 M21 M21

获取或设置此 Matrix 结构中第二行与第一列相交处的值。Gets or sets the value of the second row and first column of this Matrix structure.

M22 M22 M22 M22

获取或设置此 Matrix 结构中第二行与第二列相交处的值。Gets or sets the value of the second row and second column of this Matrix structure.

OffsetX OffsetX OffsetX OffsetX

获取或设置此 Matrix 结构中第三行与第一列相交处的值。Gets or sets the value of the third row and first column of this Matrix structure.

OffsetY OffsetY OffsetY OffsetY

获取或设置此 Matrix 结构中第三行与第二列相交处的值。Gets or sets the value of the third row and second column of this Matrix structure.

方法

Append(Matrix) Append(Matrix) Append(Matrix) Append(Matrix)

将指定的 Matrix 结构追加到此 Matrix 结构。Appends the specified Matrix structure to this Matrix structure.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的 Object 是否是一个与此 Matrix 相同的 Matrix 结构。Determines whether the specified Object is a Matrix structure that is identical to this Matrix.

Equals(Matrix) Equals(Matrix) Equals(Matrix) Equals(Matrix)

确定指定的 Matrix 结构是否与此实例相同。Determines whether the specified Matrix structure is identical to this instance.

Equals(Matrix, Matrix) Equals(Matrix, Matrix) Equals(Matrix, Matrix) Equals(Matrix, Matrix)

确定两个指定的 Matrix 结构是否相同。Determines whether the two specified Matrix structures are identical.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

返回此 Matrix 结构的哈希代码。Returns the hash code for this Matrix structure.

Invert() Invert() Invert() Invert()

反转此 Matrix 结构。Inverts this Matrix structure.

Multiply(Matrix, Matrix) Multiply(Matrix, Matrix) Multiply(Matrix, Matrix) Multiply(Matrix, Matrix)

Matrix 结构乘以另一个 Matrix 结构。Multiplies a Matrix structure by another Matrix structure.

Parse(String) Parse(String) Parse(String) Parse(String)

将矩阵的 String 表示形式转换为等效的 Matrix 结构。Converts a String representation of a matrix into the equivalent Matrix structure.

Prepend(Matrix) Prepend(Matrix) Prepend(Matrix) Prepend(Matrix)

将指定的 Matrix 结构添加到此 Matrix 结构之前。Prepends the specified Matrix structure onto this Matrix structure.

Rotate(Double) Rotate(Double) Rotate(Double) Rotate(Double)

以此 Matrix 结构的原点为中心旋转指定的角度。Applies a rotation of the specified angle about the origin of this Matrix structure.

RotateAt(Double, Double, Double) RotateAt(Double, Double, Double) RotateAt(Double, Double, Double) RotateAt(Double, Double, Double)

绕指定的点旋转此矩阵。Rotates this matrix about the specified point.

RotateAtPrepend(Double, Double, Double) RotateAtPrepend(Double, Double, Double) RotateAtPrepend(Double, Double, Double) RotateAtPrepend(Double, Double, Double)

在此 Matrix 结构前面添加围绕指定点的指定角度的旋转。Prepends a rotation of the specified angle at the specified point to this Matrix structure.

RotatePrepend(Double) RotatePrepend(Double) RotatePrepend(Double) RotatePrepend(Double)

在此 Matrix 结构前面添加指定角度的旋转。Prepends a rotation of the specified angle to this Matrix structure.

Scale(Double, Double) Scale(Double, Double) Scale(Double, Double) Scale(Double, Double)

在此 Matrix 结构后面追加指定的缩放向量。Appends the specified scale vector to this Matrix structure.

ScaleAt(Double, Double, Double, Double) ScaleAt(Double, Double, Double, Double) ScaleAt(Double, Double, Double, Double) ScaleAt(Double, Double, Double, Double)

围绕指定的点按指定的量缩放此 MatrixScales this Matrix by the specified amount about the specified point.

ScaleAtPrepend(Double, Double, Double, Double) ScaleAtPrepend(Double, Double, Double, Double) ScaleAtPrepend(Double, Double, Double, Double) ScaleAtPrepend(Double, Double, Double, Double)

在此 Matrix 前面添加围绕指定点的指定缩放。Prepends the specified scale about the specified point of this Matrix.

ScalePrepend(Double, Double) ScalePrepend(Double, Double) ScalePrepend(Double, Double) ScalePrepend(Double, Double)

在此 Matrix 结构前面添加指定的缩放向量。Prepends the specified scale vector to this Matrix structure.

SetIdentity() SetIdentity() SetIdentity() SetIdentity()

将此 Matrix 结构更改为恒等矩阵。Changes this Matrix structure into an identity matrix.

Skew(Double, Double) Skew(Double, Double) Skew(Double, Double) Skew(Double, Double)

在此 Matrix 结构后面追加 x 和 y 维中指定角度的扭曲。Appends a skew of the specified degrees in the x and y dimensions to this Matrix structure.

SkewPrepend(Double, Double) SkewPrepend(Double, Double) SkewPrepend(Double, Double) SkewPrepend(Double, Double)

在此 Matrix 结构前面添加 x 和 y 维中指定角度的扭曲。Prepends a skew of the specified degrees in the x and y dimensions to this Matrix structure.

ToString() ToString() ToString() ToString()

创建此 String 结构的 Matrix 表示形式。Creates a String representation of this Matrix structure.

ToString(IFormatProvider) ToString(IFormatProvider) ToString(IFormatProvider) ToString(IFormatProvider)

使用区域性特定的格式设置信息创建此 String 结构的 Matrix 表示形式。Creates a String representation of this Matrix structure with culture-specific formatting information.

Transform(Point) Transform(Point) Transform(Point) Transform(Point)

Matrix 变换指定的点并返回结果。Transforms the specified point by the Matrix and returns the result.

Transform(Point[]) Transform(Point[]) Transform(Point[]) Transform(Point[])

用此 Matrix 变换指定的点。Transforms the specified points by this Matrix.

Transform(Vector) Transform(Vector) Transform(Vector) Transform(Vector)

用此 Matrix 变换指定的向量。Transforms the specified vector by this Matrix.

Transform(Vector[]) Transform(Vector[]) Transform(Vector[]) Transform(Vector[])

用此 Matrix 变换指定的向量。Transforms the specified vectors by this Matrix.

Translate(Double, Double) Translate(Double, Double) Translate(Double, Double) Translate(Double, Double)

在此 Matrix 结构后面追加指定偏移量的平移。Appends a translation of the specified offsets to this Matrix structure.

TranslatePrepend(Double, Double) TranslatePrepend(Double, Double) TranslatePrepend(Double, Double) TranslatePrepend(Double, Double)

在此 Matrix 结构前面添加指定偏移量的平移。Prepends a translation of the specified offsets to this Matrix structure.

操作员

Equality(Matrix, Matrix) Equality(Matrix, Matrix) Equality(Matrix, Matrix) Equality(Matrix, Matrix)

确定两个指定的 Matrix 结构是否相同。Determines whether the two specified Matrix structures are identical.

Inequality(Matrix, Matrix) Inequality(Matrix, Matrix) Inequality(Matrix, Matrix) Inequality(Matrix, Matrix)

确定两个指定的 Matrix 结构是否不同。Determines whether the two specified Matrix structures are not identical.

Multiply(Matrix, Matrix) Multiply(Matrix, Matrix) Multiply(Matrix, Matrix) Multiply(Matrix, Matrix)

Matrix 结构乘以另一个 Matrix 结构。Multiplies a Matrix structure by another Matrix structure.

显式界面实现

IFormattable.ToString(String, IFormatProvider) IFormattable.ToString(String, IFormatProvider) IFormattable.ToString(String, IFormatProvider) IFormattable.ToString(String, IFormatProvider)

使用指定的格式格式化当前实例的值。Formats the value of the current instance using the specified format.

适用于

另请参阅