GraphicsPathIterator::CopyData メソッド (gdipluspath.h)

GraphicsPathIterator::CopyData メソッドは、パスのデータ ポイントのサブセットを PointF 配列にコピーし、パスのポイント型のサブセットを BYTE 配列にコピーします。

構文

INT CopyData(
  [out] PointF *points,
  [out] BYTE   *types,
  [in]  INT    startIndex,
  [in]  INT    endIndex
);

パラメーター

[out] points

種類: PointF*

パスのデータ ポイントのサブセットを受け取る配列へのポインター。

[out] types

型: BYTE*

パスのポイント型のサブセットを受け取る配列へのポインター。

[in] startIndex

型: INT

コピーするポイントと型の開始インデックスを指定する整数。

[in] endIndex

型: INT

コピーするポイントと型の終了インデックスを指定する整数。

戻り値

型: INT

このメソッドは、コピーされたポイントの数を返します。 これは、コピーされた型の数と同じです。

注釈

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

GraphicsPathIterator::GetCount メソッドを呼び出して、パス内のデータ ポイントの数を決定できます。

次の例では、 GraphicsPath オブジェクトを作成し、パスに 3 行を追加します。 このコードでは 、GraphicsPathIterator> オブジェクトを作成し 、その GraphicsPathIterator::CopyData メソッドを呼び出して、パスのポイントとポイントの種類を取得します。 次に、 GraphicsPathIterator::CopyData メソッドによって返されるカウントがコードに表示されます。


#define BUFFER_SIZE 30
TCHAR numPointsCopied[BUFFER_SIZE];

// Create the points for three lines in a path.
Point pts[] = { Point(20, 20), 
                Point(100, 20), 
                Point(100, 50), 
                Point(20, 50) };
GraphicsPath path;
path.AddLines(pts, 4); // Add the lines to the path.

// Create a GraphicsPathIterator object and associate it with the path. 
GraphicsPathIterator pathIterator(&path);

// Create destination arrays, and copy the path data to them.
PointF* pCopiedPoints = new PointF[4]; 
BYTE* pTypes = new BYTE[4];
INT count = pathIterator.CopyData(pCopiedPoints, pTypes, 0, 3);

// Confirm that the points copied.
StringCchPrintf(
   numPointsCopied, BUFFER_SIZE, TEXT("%d points were copied."), count);

MessageBox(hWnd, numPointsCopied, TEXT("CopyData"), NULL);

delete[] pCopiedPoints;
delete[] pTypes;

要件

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

関連項目

パスの作成および描画

GetPathData

GetPathPoints メソッド

GetPathTypes

GetPointCount

Graphicspath

GraphicsPathIterator

GraphicsPathIterator::Enumerate

GraphicsPathIterator::GetCount

パス