LinearGradientBrush::MultiplyTransform メソッド (gdiplusbrush.h)

LinearGradientBrush::MultiplyTransform メソッドは、このブラシの変換行列をそれ自体と別の行列の積で更新します。

構文

Status MultiplyTransform(
  [in] const Matrix *matrix,
  [in] MatrixOrder  order
);

パラメーター

[in] matrix

型: const Matrix*

ブラシの現在の変換行列で乗算されるマトリックスへのポインター。

[in] order

型: MatrixOrder

省略可能。 乗算の順序を指定する MatrixOrder 列挙体の要素。 MatrixOrderPrepend は、渡された行列が左側にあることを指定し、MatrixOrderAppend は、渡された行列が右側にあることを指定します。 既定値は MatrixOrderPrepend です。

戻り値

種類: 状態

メソッドが成功した場合は、 Status 列挙体の要素である Ok を返します。

メソッドが失敗した場合は、 Status 列挙体の他の要素のいずれかを返します。

解説

単一の 3 ×3 行列は、アフィン変換の任意のシーケンスを格納できます。 複数の 3 ×3 個の行列があり、それぞれがアフィン変換を表す場合、それらの行列の積は、変換のシーケンス全体を表す単一の 3 ×3 行列です。 その製品によって表される変換は、複合変換と呼ばれます。 たとえば、行列 R が回転を表し、行列 T が平行移動を表す場合です。 行列 M が積 RT の場合、行列 M は複合変換を表します。最初に回転し、次に平行移動します。

行列乗算の順序は重要です。 一般に、マトリックス積RTはマトリックス積TRと同じではない。 前の段落で指定した例では、RT で表される複合変換 (最初の回転、次に平行移動) は、TR で表される複合変換 (最初の変換、回転) と同じではありません。

次の例では、線形グラデーション ブラシを作成し、それを使用して四角形を塗りつぶします。 次に、コードはブラシの変換マトリックスを設定し、変換されたブラシで四角形を塗りつぶし、ブラシの変換マトリックスを変更して、もう一度変換されたブラシで四角形を塗りつぶします。

VOID Example_MultTrans(HDC hdc)
{
   Graphics myGraphics(hdc);

   Matrix S(2, 0, 0, 1, 0, 0);   // horizontal doubling
   Matrix T(1, 0, 0, 1, 50, 0);  // horizontal translation of 50 units

   LinearGradientBrush linGrBrush(
      Rect(0, 0, 200, 100),
      Color(255, 255, 0, 0),     // red
      Color(255, 0, 0, 255),     // blue
      LinearGradientModeHorizontal);

   // Fill a large area with the gradient brush (no transformation).
   myGraphics.FillRectangle(&linGrBrush, 0, 0, 800, 100);

   // Apply the scaling transformation.
   linGrBrush.SetTransform(&S);

   // Fill a large area with the scaled gradient brush.
   myGraphics.FillRectangle(&linGrBrush, 0, 150, 800, 100);

   // Form a composite transformation: first scale, then translate.
   linGrBrush.MultiplyTransform(&T, MatrixOrderAppend);

   // Fill a large area with the scaled and translated gradient brush.
   myGraphics.FillRectangle(&linGrBrush, 0, 300, 800, 100);
}

要件

   
サポートされている最小のクライアント Windows XP、Windows 2000 Professional [デスクトップ アプリのみ]
サポートされている最小のサーバー Windows 2000 Server [デスクトップ アプリのみ]
対象プラットフォーム Windows
ヘッダー gdiplusbrush.h (Gdiplus.h を含む)
Library Gdiplus.lib
[DLL] Gdiplus.dll

関連項目

ブラシと図形の塗りつぶし

グラデーション ブラシを使用した図形の塗りつぶし

LinearGradientBrush

LinearGradientBrush::RotateTransform

LinearGradientBrush::ScaleTransform

LinearGradientBrush::TranslateTransform

マトリックス

変換の行列表現

MatrixOrder

Rect

変換