GraphicsPath::GetPathPoints(PointF*,INT) メソッド (gdipluspath.h)

GraphicsPath::GetPathPoints メソッドは、このパスのポイントの配列を取得します。 配列には、パスの描画に使用される線分とベジエ スプラインの端点と制御点が含まれます。

構文

Status GetPathPoints(
  PointF *points,
  INT    count
);

パラメーター

points

データ ポイントを受け取る PointF オブジェクトの配列へのポインター。 この配列にはメモリを割り当てる必要があります。 GraphicsPath::GetPointCount メソッドを呼び出して、配列の必要なサイズを決定できます。 サイズ (バイト単位) は、 GraphicsPath::GetPointCount の戻り値に を乗算した sizeof(PointF)値にする必要があります。

count

ポイント配列内の要素の数を指定する整数。 このパラメーターを GraphicsPath::GetPointCount メソッドの戻り値と同じに設定します。

戻り値

Type:Status

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

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

注釈

GraphicsPath オブジェクトには、ポイントの配列と型の配列があります。 型の配列内の各要素は、ポイントの型と、ポイントの配列内の対応する要素のフラグのセットを指定するバイトです。 使用可能なポイントの種類とフラグは、PathPointType 列挙に一覧表示されます。

次の例では、線、四角形、楕円、曲線を含むパスを作成して描画します。 このコードでは、パスの GraphicsPath::GetPointCount メソッドを呼び出して、パスに格納されているデータ ポイントの数を決定します。 このコードでは、データ ポイントの配列を受け取るのに十分な大きさのバッファーを割り当て、そのバッファーのアドレスを GraphicsPath::GetPathPoints メソッドに渡します。 最後に、各パスのデータ ポイントを描画します。

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

   // Create a path that has a line, a rectangle, an ellipse, and a curve.
   GraphicsPath path;

   PointF points[] = {
      PointF(200, 200),
      PointF(250, 240),
      PointF(200, 300),
      PointF(300, 310),
      PointF(250, 350)};

   path.AddLine(20, 100, 150, 200);
   path.AddRectangle(Rect(40, 30, 80, 60));
   path.AddEllipse(Rect(200, 30, 200, 100));
   path.AddCurve(points, 5);

   // Draw the path.
   Pen pen(Color(255, 0, 0, 255));
   graphics.DrawPath(&pen, &path);

   // Get the path points.
   INT count = path.GetPointCount();
   PointF* dataPoints = new PointF[count];  
   path.GetPathPoints(dataPoints, count);

   // Draw the path's data points.
   SolidBrush brush(Color(255, 255, 0, 0));
   for(INT j = 0; j < count; ++j)
   {
      graphics.FillEllipse(
         &brush, 
         dataPoints[j].X - 3.0f, 
         dataPoints[j].Y - 3.0f,
         6.0f,
         6.0f);
   }
   delete [] dataPoints; 
}
Color(255, 255, 0,  0)

要件

要件
Header gdipluspath.h

こちらもご覧ください

Graphicspath

GraphicsPath::GetPathData

GraphicsPath::GetPathTypes

GraphicsPath::GetPointCount

PathData

PathPointType

Pointf

領域を使用したクリッピング

パスの作成および描画

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

パス