Graphics.MultiplyTransform Metoda

Definice

Vynásobí světovou transformaci tohoto Graphics a určí hodnotu Matrix.

Přetížení

MultiplyTransform(Matrix)

Vynásobí světovou transformaci tohoto Graphics a určí hodnotu Matrix.

MultiplyTransform(Matrix, MatrixOrder)

Vynásobí svět transformace tohoto Graphics a zadá v Matrix zadaném pořadí.

MultiplyTransform(Matrix)

Zdroj:
Graphics.cs
Zdroj:
Graphics.cs
Zdroj:
Graphics.cs

Vynásobí světovou transformaci tohoto Graphics a určí hodnotu Matrix.

public:
 void MultiplyTransform(System::Drawing::Drawing2D::Matrix ^ matrix);
public void MultiplyTransform (System.Drawing.Drawing2D.Matrix matrix);
member this.MultiplyTransform : System.Drawing.Drawing2D.Matrix -> unit
Public Sub MultiplyTransform (matrix As Matrix)

Parametry

matrix
Matrix

4x4 Matrix , která násobí transformaci světa.

Příklady

Následující příklad kódu je navržený pro použití s model Windows Forms a vyžaduje PaintEventArgse, což je parametr obslužné rutiny Paint události. Kód provede následující akce:

  • Vytvoří matici transformMatrix (dvě po dvou matici identit plus vektor nulového překladu).

  • Převede transformační matici vektorem (200, 100).

  • Otočí světovou transformační matici formuláře Windows o 30 stupňů, předpendá matici otáčení o 30 stupňů k matici transformace formuláře.

  • Vynásobí otočenou světovou transformační matici přeloženou transformMatrixmaticí a předpendí transformMatrix k matici transformace světa.

  • Nakreslí otočenou, přeloženou elipsu.

public:
   void MultiplyTransformMatrix( PaintEventArgs^ e )
   {
      // Create transform matrix.
      Matrix^ transformMatrix = gcnew Matrix;

      // Translate matrix, prepending translation vector.
      transformMatrix->Translate( 200.0F, 100.0F );

      // Rotate transformation matrix of graphics object,
      // prepending rotation matrix.
      e->Graphics->RotateTransform( 30.0F );

      // Multiply (prepend to) transformation matrix of
      // graphics object to translate graphics transformation.
      e->Graphics->MultiplyTransform( transformMatrix );

      // Draw rotated, translated ellipse.
      e->Graphics->DrawEllipse( gcnew Pen( Color::Blue,3.0f ), -80, -40, 160, 80 );
   }
private void MultiplyTransformMatrix(PaintEventArgs e)
{

    // Create transform matrix.
    Matrix transformMatrix = new Matrix();

    // Translate matrix, prepending translation vector.
    transformMatrix.Translate(200.0F, 100.0F);

    // Rotate transformation matrix of graphics object,

    // prepending rotation matrix.
    e.Graphics.RotateTransform(30.0F);

    // Multiply (prepend to) transformation matrix of

    // graphics object to translate graphics transformation.
    e.Graphics.MultiplyTransform(transformMatrix);

    // Draw rotated, translated ellipse.
    e.Graphics.DrawEllipse(new Pen(Color.Blue, 3), -80, -40, 160, 80);
}
Private Sub MultiplyTransformMatrix(ByVal e As PaintEventArgs)

    ' Create transform matrix.
    Dim transformMatrix As New Matrix

    ' Translate matrix, prepending translation vector.
    transformMatrix.Translate(200.0F, 100.0F)

    ' Rotate transformation matrix of graphics object,

    ' prepending rotation matrix.
    e.Graphics.RotateTransform(30.0F)

    ' Multiply (prepend to) transformation matrix of

    ' graphics object to translate graphics transformation.
    e.Graphics.MultiplyTransform(transformMatrix)

    ' Draw rotated, translated ellipse.
    e.Graphics.DrawEllipse(New Pen(Color.Blue, 3), -80, -40, 160, 80)
End Sub

Poznámky

Tato metoda předpenduje matici určenou parametrem matrix , takže výsledkem je matrix transformace x světa.

Viz také

Platí pro

MultiplyTransform(Matrix, MatrixOrder)

Zdroj:
Graphics.cs
Zdroj:
Graphics.cs
Zdroj:
Graphics.cs

Vynásobí svět transformace tohoto Graphics a zadá v Matrix zadaném pořadí.

public:
 void MultiplyTransform(System::Drawing::Drawing2D::Matrix ^ matrix, System::Drawing::Drawing2D::MatrixOrder order);
public void MultiplyTransform (System.Drawing.Drawing2D.Matrix matrix, System.Drawing.Drawing2D.MatrixOrder order);
member this.MultiplyTransform : System.Drawing.Drawing2D.Matrix * System.Drawing.Drawing2D.MatrixOrder -> unit
Public Sub MultiplyTransform (matrix As Matrix, order As MatrixOrder)

Parametry

matrix
Matrix

4x4 Matrix , která násobí transformaci světa.

order
MatrixOrder

Člen výčtu MatrixOrder , který určuje pořadí násobení.

Příklady

Následující příklad kódu je navržený pro použití s model Windows Forms a vyžaduje PaintEventArgse, což je parametr obslužné rutiny Paint události. Kód provede následující akce:

  • Vytvoří matici transformMatrix (dvě po dvou matici identit plus vektor nulového překladu).

  • Převede transformační matici vektorem (200, 100).

  • Otočí světovou transformační matici formuláře Windows o 30 stupňů před matici otáčení o 30 stupňů k matici transformace formuláře.

  • Vynásobí otočenou světovou transformační matici přeloženou transformMatrixa připojí transformMatrix k matici transformace světa .

  • Nakreslí otočenou, přeloženou elipsu.

public:
   void MultiplyTransformMatrixOrder( PaintEventArgs^ e )
   {
      // Create transform matrix.
      Matrix^ transformMatrix = gcnew Matrix;

      // Translate matrix, prepending translation vector.
      transformMatrix->Translate( 200.0F, 100.0F );

      // Rotate transformation matrix of graphics object,
      // prepending rotation matrix.
      e->Graphics->RotateTransform( 30.0F );

      // Multiply (append to) transformation matrix of
      // graphics object to translate graphics transformation.
      e->Graphics->MultiplyTransform( transformMatrix, MatrixOrder::Append );

      // Draw rotated, translated ellipse.
      e->Graphics->DrawEllipse( gcnew Pen( Color::Blue,3.0f ), -80, -40, 160, 80 );
   }
private void MultiplyTransformMatrixOrder(PaintEventArgs e)
{

    // Create transform matrix.
    Matrix transformMatrix = new Matrix();

    // Translate matrix, prepending translation vector.
    transformMatrix.Translate(200.0F, 100.0F);

    // Rotate transformation matrix of graphics object,

    // prepending rotation matrix.
    e.Graphics.RotateTransform(30.0F);

    // Multiply (append to) transformation matrix of

    // graphics object to translate graphics transformation.
    e.Graphics.MultiplyTransform(transformMatrix, MatrixOrder.Append);

    // Draw rotated, translated ellipse.
    e.Graphics.DrawEllipse(new Pen(Color.Blue, 3), -80, -40, 160, 80);
}
Private Sub MultiplyTransformMatrixOrder(ByVal e As PaintEventArgs)

    ' Create transform matrix.
    Dim transformMatrix As New Matrix

    ' Translate matrix, prepending translation vector.
    transformMatrix.Translate(200.0F, 100.0F)

    ' Rotate transformation matrix of graphics object,

    ' prepending rotation matrix.
    e.Graphics.RotateTransform(30.0F)

    ' Multiply (append to) transformation matrix of

    ' graphics object to translate graphics transformation.
    e.Graphics.MultiplyTransform(transformMatrix, MatrixOrder.Append)

    ' Draw rotated, translated ellipse.
    e.Graphics.DrawEllipse(New Pen(Color.Blue, 3), -80, -40, 160, 80)
End Sub

Poznámky

Hodnota Prepend parametru order určuje, že pořadí násobení je matrix x transformace světa. Hodnota Append pro order určuje, že pořadí násobení je svět transformace x matrix.

Viz také

Platí pro