PathGradientBrush::GetTransform メソッド (gdipluspath.h)

PathGradientBrush::GetTransform メソッドは、このパス グラデーション ブラシの変換マトリックスを取得します。

構文

Status GetTransform(
  [out] Matrix *matrix
);

パラメーター

[out] matrix

種類: マトリックス*

変換マトリックスを受け取る Matrix オブジェクトへのポインター。

戻り値

種類: 状態

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

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

解説

PathGradientBrush オブジェクトは、アフィン変換を格納できる変換マトリックスを保持します。 パス グラデーション ブラシを使用して領域を塗りつぶすと、GDI+ はブラシの変換マトリックスに従ってブラシの境界パスを変換し、変換されたパスの内部を塗りつぶします。 変換されたパスは、レンダリング中にのみ存在します。 PathGradientBrush オブジェクトに格納されている境界パスは変換されません。

次の例では、3 つのポイントの配列に基づいて PathGradientBrush オブジェクトを作成します。 PathGradientBrush::ScaleTransform メソッドと PathGradientBrush::TranslateTransform メソッドは、ブラシの変換マトリックスの要素を設定して、マトリックスが複合変換 (最初のスケール、次に翻訳) を表すよう設定します。 この複合変換はブラシの境界パスに適用されるため、 FillRectangle を呼び出すと、境界パスのスケーリングと変換の結果である三角形の内部が塗りつぶされます。 このコードでは、PathGradientBrush オブジェクトの PathGradientBrush::GetTransform メソッドを呼び出してブラシの変換マトリックスを取得し、取得した Matrix オブジェクトの GetElements メソッドを呼び出して、配列にマトリックス要素を格納します。

VOID Example_GetTransform(HDC hdc)
{
  Graphics graphics(hdc);

   // Create a path gradient brush and set its transformation.
   Point pts[] = {Point(0, 0), Point(50, 0), Point(50, 50)};
   PathGradientBrush pthGrBrush(pts, 3);
   pthGrBrush.ScaleTransform(3.0f, 1.0f);
   pthGrBrush.TranslateTransform(10.0f, 30.0f, MatrixOrderAppend);

   graphics.FillRectangle(&pthGrBrush, 0, 0, 200, 200);

   // Obtain information about the path gradient brush.
   Matrix matrix;
   REAL elements[6];

   pthGrBrush.GetTransform(&matrix);
   matrix.GetElements(elements);

   for(INT j = 0; j <= 5; ++j)
   {
      // Inspect or use the value in elements[j].
   } 
}

要件

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

関連項目

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

パス グラデーションの作成

色のグラデーションで図形を塗りつぶす

マトリックス

変換の行列表現

PathGradientBrush

PathGradientBrush::SetTransform

変換