Matrix.Transform 方法

定義

依這個 Matrix,轉換指定的點、點陣列或向量陣列。

多載

Transform(Point)

Matrix 轉換指定的點,然後傳回結果。

Transform(Point[])

依這個 Matrix 轉換指定的點。

Transform(Vector)

依這個 Matrix 轉換指定的向量。

Transform(Vector[])

依這個 Matrix 轉換指定的向量。

範例

下列範例示範如何使用 Matrix 來轉換點和向量。

private void transformExamples()
{

     Matrix myMatrix = new Matrix(5, 10, 15, 20, 25, 30);

     //
     // Transform a point.
     //            
     Point myPoint = new Point(15,25);
     
     // pointResult is (475, 680).
     Point pointResult = myMatrix.Transform(myPoint);
     
     //
     // Transform an array of points.
     //            
     Point[] myPointArray = new Point[]
        {new Point(15,25), new Point(30,35)};
        
     // myPointArray[0] becomes (475, 680).
     // myPointArray[1] becomes (700, 1030).
     myMatrix.Transform(myPointArray);
        
     //
     // Transform a vector.
     //
     Vector myVector = new Vector(15,25);
     
     // vectorResult becomes (450, 650).
     Vector vectorResult = myMatrix.Transform(myVector);
     
     //
     // Transform an array of vectors.
     //
     Vector[] myVectorArray = new Vector[]
        {new Vector(15, 25), new Vector(30,35)};
     
     // myVectorArray[0] becomes (450, 650).
     // myVectorArray[1] becomes (675, 1000).             
     myMatrix.Transform(myVectorArray);   
}

Transform(Point)

Matrix 轉換指定的點,然後傳回結果。

public:
 System::Windows::Point Transform(System::Windows::Point point);
public System.Windows.Point Transform (System.Windows.Point point);
member this.Transform : System.Windows.Point -> System.Windows.Point
Public Function Transform (point As Point) As Point

參數

point
Point

要轉換的點。

傳回

依這個 Matrix 轉換 point 的結果。

範例

下列範例示範如何使用 Matrix 來轉換點和向量。

private void transformExamples()
{

     Matrix myMatrix = new Matrix(5, 10, 15, 20, 25, 30);

     //
     // Transform a point.
     //            
     Point myPoint = new Point(15,25);
     
     // pointResult is (475, 680).
     Point pointResult = myMatrix.Transform(myPoint);
     
     //
     // Transform an array of points.
     //            
     Point[] myPointArray = new Point[]
        {new Point(15,25), new Point(30,35)};
        
     // myPointArray[0] becomes (475, 680).
     // myPointArray[1] becomes (700, 1030).
     myMatrix.Transform(myPointArray);
        
     //
     // Transform a vector.
     //
     Vector myVector = new Vector(15,25);
     
     // vectorResult becomes (450, 650).
     Vector vectorResult = myMatrix.Transform(myVector);
     
     //
     // Transform an array of vectors.
     //
     Vector[] myVectorArray = new Vector[]
        {new Vector(15, 25), new Vector(30,35)};
     
     // myVectorArray[0] becomes (450, 650).
     // myVectorArray[1] becomes (675, 1000).             
     myMatrix.Transform(myVectorArray);   
}

適用於

Transform(Point[])

依這個 Matrix 轉換指定的點。

public:
 void Transform(cli::array <System::Windows::Point> ^ points);
public void Transform (System.Windows.Point[] points);
member this.Transform : System.Windows.Point[] -> unit
Public Sub Transform (points As Point())

參數

points
Point[]

要轉換的點。 陣列中的原始點由其轉換值取代。

範例

下列範例示範如何使用 Matrix 來轉換點和向量。

private void transformExamples()
{

     Matrix myMatrix = new Matrix(5, 10, 15, 20, 25, 30);

     //
     // Transform a point.
     //            
     Point myPoint = new Point(15,25);
     
     // pointResult is (475, 680).
     Point pointResult = myMatrix.Transform(myPoint);
     
     //
     // Transform an array of points.
     //            
     Point[] myPointArray = new Point[]
        {new Point(15,25), new Point(30,35)};
        
     // myPointArray[0] becomes (475, 680).
     // myPointArray[1] becomes (700, 1030).
     myMatrix.Transform(myPointArray);
        
     //
     // Transform a vector.
     //
     Vector myVector = new Vector(15,25);
     
     // vectorResult becomes (450, 650).
     Vector vectorResult = myMatrix.Transform(myVector);
     
     //
     // Transform an array of vectors.
     //
     Vector[] myVectorArray = new Vector[]
        {new Vector(15, 25), new Vector(30,35)};
     
     // myVectorArray[0] becomes (450, 650).
     // myVectorArray[1] becomes (675, 1000).             
     myMatrix.Transform(myVectorArray);   
}

適用於

Transform(Vector)

依這個 Matrix 轉換指定的向量。

public:
 System::Windows::Vector Transform(System::Windows::Vector vector);
public System.Windows.Vector Transform (System.Windows.Vector vector);
member this.Transform : System.Windows.Vector -> System.Windows.Vector
Public Function Transform (vector As Vector) As Vector

參數

vector
Vector

要轉換的向量。

傳回

依這個 Matrix 轉換 vector 的結果。

範例

下列範例示範如何使用 Matrix 來轉換點和向量。

private void transformExamples()
{

     Matrix myMatrix = new Matrix(5, 10, 15, 20, 25, 30);

     //
     // Transform a point.
     //            
     Point myPoint = new Point(15,25);
     
     // pointResult is (475, 680).
     Point pointResult = myMatrix.Transform(myPoint);
     
     //
     // Transform an array of points.
     //            
     Point[] myPointArray = new Point[]
        {new Point(15,25), new Point(30,35)};
        
     // myPointArray[0] becomes (475, 680).
     // myPointArray[1] becomes (700, 1030).
     myMatrix.Transform(myPointArray);
        
     //
     // Transform a vector.
     //
     Vector myVector = new Vector(15,25);
     
     // vectorResult becomes (450, 650).
     Vector vectorResult = myMatrix.Transform(myVector);
     
     //
     // Transform an array of vectors.
     //
     Vector[] myVectorArray = new Vector[]
        {new Vector(15, 25), new Vector(30,35)};
     
     // myVectorArray[0] becomes (450, 650).
     // myVectorArray[1] becomes (675, 1000).             
     myMatrix.Transform(myVectorArray);   
}

適用於

Transform(Vector[])

依這個 Matrix 轉換指定的向量。

public:
 void Transform(cli::array <System::Windows::Vector> ^ vectors);
public void Transform (System.Windows.Vector[] vectors);
member this.Transform : System.Windows.Vector[] -> unit
Public Sub Transform (vectors As Vector())

參數

vectors
Vector[]

要轉換的向量。 陣列中的原始向量會以轉換後的值取代。

範例

下列範例示範如何使用 Matrix 來轉換點和向量。

private void transformExamples()
{

     Matrix myMatrix = new Matrix(5, 10, 15, 20, 25, 30);

     //
     // Transform a point.
     //            
     Point myPoint = new Point(15,25);
     
     // pointResult is (475, 680).
     Point pointResult = myMatrix.Transform(myPoint);
     
     //
     // Transform an array of points.
     //            
     Point[] myPointArray = new Point[]
        {new Point(15,25), new Point(30,35)};
        
     // myPointArray[0] becomes (475, 680).
     // myPointArray[1] becomes (700, 1030).
     myMatrix.Transform(myPointArray);
        
     //
     // Transform a vector.
     //
     Vector myVector = new Vector(15,25);
     
     // vectorResult becomes (450, 650).
     Vector vectorResult = myMatrix.Transform(myVector);
     
     //
     // Transform an array of vectors.
     //
     Vector[] myVectorArray = new Vector[]
        {new Vector(15, 25), new Vector(30,35)};
     
     // myVectorArray[0] becomes (450, 650).
     // myVectorArray[1] becomes (675, 1000).             
     myMatrix.Transform(myVectorArray);   
}

適用於