Graphics::D rawBeziers(constPen*,constPoint*,INT) メソッド (gdiplusgraphics.h)

Graphics::D rawBeziers メソッドは、接続されたベジエ スプラインのシーケンスを描画します。

構文

Status DrawBeziers(
  [in] const Pen   *pen,
  [in] const Point *points,
  [in] INT         count
);

パラメーター

[in] pen

種類: const Pen*

ベジエ スプラインの描画に使用されるペンへのポインター。

[in] points

型: const Point*

ベジエ スプラインの始点、終点、およびコントロール ポイントを指定する Point オブジェクトの配列へのポインター。 1 つのベジエ スプラインの終了座標は、次のベジエ スプラインの開始座標です。

[in] count

型: INT

points 配列内の要素の数を指定する整数。

戻り値

種類: 状態

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

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

解説

ベジエ スプラインは、コントロール ポイントを通過しません。 コントロール ポイントは磁石として機能し、ベジェ スプラインの曲げ方に影響を与えるために特定の方向に曲線を引っ張ります。

次の例では、ベジエ曲線のペアを描画します。


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

   // Define a Pen object and an array of Point objects.
   Pen greenPen(Color(255, 0, 255, 0), 3);

   Point startPoint(100, 100);
   Point ctrlPoint1(200, 50);
   Point ctrlPoint2(400, 10);
   Point endPoint1(500, 100);
   Point ctrlPoint3(600, 200);
   Point ctrlPoint4(700, 400);
   Point endPoint2(500, 500);

   Point curvePoints[7] = {
      startPoint,
      ctrlPoint1,
      ctrlPoint2,
      endPoint1,
      ctrlPoint3,
      ctrlPoint4,
      endPoint2};

   // Draw the Bezier curves.
   graphics.DrawBeziers(&greenPen, curvePoints, 7);

   // Draw the control and end points.
   SolidBrush redBrush(Color(255, 255, 0, 0));
   graphics.FillEllipse(&redBrush, Rect(100 - 5, 100 - 5, 10, 10));
   graphics.FillEllipse(&redBrush, Rect(500 - 5, 100 - 5, 10, 10));
   graphics.FillEllipse(&redBrush, Rect(500 - 5, 500 - 5, 10, 10));
   SolidBrush blueBrush(Color(255, 0, 0, 255));
   graphics.FillEllipse(&blueBrush, Rect(200 - 5, 50 - 5, 10, 10));
   graphics.FillEllipse(&blueBrush, Rect(400 - 5, 10 - 5, 10, 10));
   graphics.FillEllipse(&blueBrush, Rect(600 - 5, 200 - 5, 10, 10));
   graphics.FillEllipse(&blueBrush, Rect(700 - 5, 400 - 5, 10, 10));
}

要件

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

関連項目

ベジエ スプライン

DrawBezier メソッド

DrawBeziers

ベジエ スプラインの描画

グラフィックス

ペン

Point