Matrix Matrix Matrix Matrix Struct

定義

表示 3x3 仿射轉換矩陣,可用於 2-D 空間中的轉換。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-D2-D x y 平面中的轉換。A 3x3 matrix is used for transformations in a 2-D2-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.

WPFWPF 會使用資料列主要順序來儲存,Matrix並具有下列結構:A 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 Attribute UsageXAML 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 屬性 (Property)。For more information, see the M11 property.

m12m12
System.Double

第一個資料列和第二個數據行中的值。The value in the first row and second column. 如需詳細資訊,請參閱 M12 屬性 (Property)。For more information, see the M12 property.

m21m21
System.Double

第二個數據列和第一個資料行中的值。The value in the second row and first column. 如需詳細資訊,請參閱 M21 屬性 (Property)。For more information, see the M21 property.

m22m22
System.Double

第二個數據列和第二個數據行中的值。The value in the second row and second column. 如需詳細資訊,請參閱 M22 屬性 (Property)。For more information, see the M22 property.

offsetXoffsetX
System.Double

第三列和第一個資料行中的值。The value in the third row and first column. 如需詳細資訊,請參閱 OffsetX 屬性 (Property)。For more information, see the OffsetX property.

offsetYoffsetY
System.Double

第三個數據列和第二個數據行中的值。The value in the third row and second column. 如需詳細資訊,請參閱 OffsetY 屬性 (Property)。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)

判斷所指定 ObjectMatrix 結構是否與這個 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)

以指定的點為中心,將這個 Matrix 縮放指定的量。Scales 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.

適用於

另請參閱