GraphicsPath::GetPathPoints(Point*,INT) メソッド (gdipluspath.h)
GraphicsPath::GetPathPoints メソッドは、このパスのポイントの配列を取得します。 配列には、パスの描画に使用される線分とベジエ スプラインの端点とコントロール ポイントが含まれます。
構文
Status GetPathPoints(
[out] Point *points,
[in] INT count
);
パラメーター
[out] points
種類: ポイント*
データ ポイントを受け取る Point オブジェクトの配列へのポインター。 この配列にはメモリを割り当てる必要があります。 GraphicsPath::GetPointCount メソッドを呼び出して、配列の必要なサイズを決定できます。 サイズ (バイト単位) は、 GraphicsPath::GetPointCount の戻り値に sizeof(Point) を掛けた値にする必要があります。
[in] count
型: INT
points 配列内の要素の数を指定する整数。 このパラメーターは 、GraphicsPath::GetPointCount メソッドの戻り値と同じ値に設定します。
戻り値
種類: 状態
メソッドが成功した場合は、 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;
Point points[] = {
Point(200, 200),
Point(250, 240),
Point(200, 300),
Point(300, 310),
Point(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();
Point* dataPoints = new Point[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)
要件
サポートされている最小のクライアント | Windows XP、Windows 2000 Professional [デスクトップ アプリのみ] |
サポートされている最小のサーバー | Windows 2000 Server [デスクトップ アプリのみ] |
対象プラットフォーム | Windows |
ヘッダー | gdipluspath.h (Gdiplus.h を含む) |
Library | Gdiplus.lib |
[DLL] | Gdiplus.dll |
関連項目
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示