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

PathGradientBrush::SetFocusScales メソッドは、このパス グラデーション ブラシのフォーカス スケールを設定します。

構文

Status SetFocusScales(
  [in] REAL xScale,
  [in] REAL yScale
);

パラメーター

[in] xScale

種類: REAL

x フォーカス スケールを指定する実数。

[in] yScale

種類: REAL

y フォーカススケールを指定する実数。

戻り値

種類: 状態

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

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

注釈

既定では、パス グラデーションの中心の色は中心点にあります。 PathGradientBrush::SetFocusScales を呼び出すと、中心点を囲むパスに沿って中心の色が表示されるように指定できます。 このパスは、x 方向の xScale の係数と y 方向の yScale の係数によってスケーリングされる境界パスです。 拡大縮小されたパス内の領域は、中心の色で塗りつぶされます。

次の例では、三角形のパスに基づいて PathGradientBrush オブジェクトを作成します。 このコードでは、PathGradientBrush オブジェクトの PathGradientBrush::SetFocusScales メソッドを呼び出して、ブラシのフォーカススケールを (0.2, 0.2) に設定します。 次に、コードはパス グラデーション ブラシを使用して、三角形のパスを含む四角形を描画します。

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

   Point points[] = {Point(100, 0), Point(200, 200), Point(0, 200)};

   // No GraphicsPath object is created. The PathGradientBrush
   // object is constructed directly from the array of points.
   PathGradientBrush pthGrBrush(points, 3);

   Color colors[] = {
      Color(255, 255, 0, 0),    // red
      Color(255, 0, 0, 255)};   // blue

   REAL relativePositions[] = {
      0.0f,    // red at the boundary of the outer triangle
      1.0f};   // blue at the boundary of the inner triangle

   pthGrBrush.SetInterpolationColors(colors, relativePositions, 2);

   // The inner triangle is formed by scaling the outer triangle
   // about its centroid. The scaling factor is 0.2 in both
   // the x and y directions.
   pthGrBrush.SetFocusScales(0.2f, 0.2f);

   // Fill a rectangle that is larger than the triangle
   // specified in the Point array. The portion of the
   // rectangle outside the triangle will not be painted.
   graphics.FillRectangle(&pthGrBrush, 0, 0, 200, 200); 
}

要件

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

こちらもご覧ください

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

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

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

PathGradientBrush

PathGradientBrush::GetFocusScales

PathGradientBrush::SetInterpolationColors