LinearGradientBrush::LinearGradientBrush(constPointF&,constPointF&,constColor&,constColor&) メソッド (gdiplusbrush.h)

境界ポイントと境界の色のセットから LinearGradientBrush::LinearGradientBrush オブジェクトを作成します。

構文

void LinearGradientBrush(
  [in, ref] const PointF & point1,
  [in, ref] const PointF & point2,
  [in, ref] const Color &  color1,
  [in, ref] const Color &  color2
);

パラメーター

[in, ref] point1

型: const PointF

グラデーションの始点を指定する Point オブジェクトへの参照。 開始境界線は開始点を通過します。

[in, ref] point2

型: const PointF

グラデーションの終了点を指定する Point オブジェクトへの参照。 終了境界線は終了点を通過します。

[in, ref] color1

型: const Color

この線形グラデーション ブラシの開始境界線の色を指定する Color オブジェクトへの参照。

[in, ref] color2

型: const Color

この線形グラデーション ブラシの終了境界線の色を指定する Color オブジェクトへの参照。

戻り値

なし

解説

仮想直線である "方向線" は、開始点 point1 と終了点 point2 によって定義されます。 グラデーションの開始境界は、方向線に対して垂直で、始点を通過する直線です。 グラデーションの終了境界は、開始境界線と平行で、終了点を通過する直線です。 グラデーションの色は、境界線に平行な線に沿って一定です。 グラデーションは、開始色から方向線に沿って終了色に徐々に変化します。

次の例では、境界ポイントと境界の色のセットから線形グラデーション ブラシを作成します。 次に、このコードではブラシを使用して四角形の内部を描画します。

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

   LinearGradientBrush linGrBrush(
      PointF(0.8f, 1.6f),
      PointF(3.0f, 2.4f),
      Color(255, 255, 0, 0),   // red
      Color(255, 0, 0, 255));  // blue

   myGraphics.SetPageUnit(UnitInch);
   myGraphics.FillRectangle(&linGrBrush, 0, 0, 4, 3); 
}

要件

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

こちらもご覧ください

Color

LinearGradientBrush

Rect