Graphics::D rawBezier(constPen*,REAL,REAL,REAL,REAL,REAL,REAL,REAL,REAL) メソッド (gdiplusgraphics.h)

Graphics::D rawBezier メソッドは、ベジエ スプラインを描画します。

構文

Status DrawBezier(
  const Pen *pen,
  REAL      x1,
  REAL      y1,
  REAL      x2,
  REAL      y2,
  REAL      x3,
  REAL      y3,
  REAL      x4,
  REAL      y4
);

パラメーター

pen

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

x1

ベジエ スプラインの始点の x 座標を指定する実数。

y1

ベジエ スプラインの始点の y 座標を指定する実数。

x2

ベジエ スプラインの最初のコントロール ポイントの x 座標を指定する実数。

y2

ベジエ スプラインの最初のコントロール ポイントの y 座標を指定する実数。

x3

ベジエ スプラインの 2 番目のコントロール ポイントの x 座標を指定する実数。

y3

ベジエ スプラインの 2 番目のコントロール ポイントの y 座標を指定する実数。

x4

ベジエ スプラインの終点の x 座標を指定する実数。

y4

ベジエ スプラインの終点の y 座標を指定する実数。

戻り値

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

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

注釈

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

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

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

   // Set up the pen and curve points.
   Pen greenPen(Color(255, 0, 255, 0));
   REAL startPointx = 100.0f;
   REAL startPointy = 100.0f;
   REAL ctrlPoint1x = 200.0f;
   REAL ctrlPoint1y = 10.0f;
   REAL ctrlPoint2x = 350.0f;
   REAL ctrlPoint2y = 50.0f;
   REAL endPointx = 500.0f;
   REAL endPointy = 100.0f;

   //Draw the curve.
   graphics.DrawBezier(
   &greenPen,
   startPointx,
   startPointy,
   ctrlPoint1x,
   ctrlPoint1y,
   ctrlPoint2x,
   ctrlPoint2y,
   endPointx,
   endPointy);

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

要件

要件
Header gdiplusgraphics.h

こちらもご覧ください

グラフィックス

DrawBezier

DrawBeziers メソッド

ペン

ベジエ スプラインの描画

ベジエ スプライン