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

LinearGradientBrush::SetTransform メソッドは、この線形グラデーション ブラシの変換マトリックスを設定します。

構文

Status SetTransform(
  [in] const Matrix *matrix
);

パラメーター

[in] matrix

型: const Matrix*

変換マトリックスを指定する Matrix オブジェクトへのポインター。

戻り値

種類: 状態

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

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

注釈

LinearGradientBrush オブジェクトには、グラデーションの開始境界と終了境界、および方向に影響を与えるモードまたは角度を指定する四角形があります。 ブラシの変換マトリックスが ID 以外の変換を表すために設定されている場合は、レンダリング時にその行列に従って境界と方向が変換されます。

変換は、レンダリング中にのみ適用されます。 LinearGradientBrush オブジェクトによって格納される境界は、LinearGradientBrush::SetTransform メソッドによって変更されません。

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

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

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

   Matrix matrix(2.0, 0, 0, 1, 0, 0);  // horizontal doubling

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

   linGrBrush.SetTransform(&matrix);

   // Fill a large area with the transformed linear gradient brush.
   myGraphics.FillRectangle(&linGrBrush, 0, 75, 800, 50);
}

要件

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

こちらもご覧ください

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

線形グラデーションの作成

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

LinearGradientBrush

LinearGradientBrush::GetTransform

LinearGradientBrush::ResetTransform

マトリックス

変換の行列表現

Rect

変換