Share via


GraphicsPathIterator::Enumerate 메서드(gdipluspath.h)

GraphicsPathIterator::Enumerate 메서드는 경로의 데이터 요소를 PointF 배열에 복사하고 경로의 점 형식을 BYTE 배열에 복사합니다.

구문

INT Enumerate(
  [out] PointF *points,
  [out] BYTE   *types,
  [in]  INT    count
);

매개 변수

[out] points

형식: PointF*

경로의 데이터 요소를 수신하는 배열에 대한 포인터입니다.

[out] types

형식: BYTE*

경로의 점 형식을 수신하는 배열에 대한 포인터입니다.

[in] count

형식: INT

배열의 요소 수를 지정하는 정수입니다. 이는 형식 배열의 요소 수와 동일합니다.

반환 값

형식: INT

이 메서드는 검색된 포인트 수를 반환합니다.

설명

GraphicsPathIterator 개체는 GraphicsPath 개체와 연결됩니다. 해당 GraphicsPath 개체에는 점 배열과 형식의 배열이 있습니다. 형식 배열의 각 요소는 점 형식을 지정하는 바이트 및 점 배열의 해당 요소에 대한 플래그 집합입니다. 가능한 점 유형 및 플래그는 PathPointType 열거형에 나열됩니다.

GraphicsPathIterator::GetCount 메서드를 호출하여 경로의 데이터 요소 수를 확인할 수 있습니다. points 매개 변수는 데이터 요소를 수신하는 버퍼를 가리키고 형식 매개 변수는 형식을 수신하는 버퍼를 가리킵니다. GraphicsPathIterator::Enumerate 메서드를 호출하기 전에 해당 버퍼에 대한 메모리를 할당해야 합니다. 포인트 버퍼의 크기는 GraphicsPathIterator::GetCountsizeof(PointF)를 곱한 반환 값이어야 합니다. 형식 버퍼의 크기는 GraphicsPathIterator::GetCount의 반환 값이어야 합니다.

예제

다음 예제에서는 GraphicsPath 개체를 만들고 경로에 세 줄을 추가합니다. 이 코드는 GraphicsPathIterator 개체를 만들고 GraphicsPathIterator::Enumerate 메서드를 호출하여 경로의 데이터 요소 및 점 형식을 검색합니다. 그런 다음, GraphicsPathIterator::Enumerate 메서드에서 반환된 개수를 코드에 표시합니다.


#define BUFFER_SIZE 30
TCHAR numPointsEnum[BUFFER_SIZE];

// Add some lines to a path.
Point pts[] = {Point(20, 20), 
                Point(100, 20), 
                Point(100, 50), 
                Point(20, 50)};
GraphicsPath path;
path.AddLines(pts, 4);

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

// Create destination arrays, and copy the path data to them.
UINT c = pathIterator.GetCount();
PointF* pEnumPoints = new PointF[c]; 
BYTE* pTypes = new BYTE[c];
INT count = pathIterator.Enumerate(pEnumPoints, pTypes, c);

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

MessageBox(hWnd, numPointsEnum, TEXT("Enumerate"), NULL);

delete[] pEnumPoints;
delete[] pTypes;

요구 사항

요구 사항
지원되는 최소 클라이언트 Windows XP, Windows 2000 Professional [데스크톱 앱만 해당]
지원되는 최소 서버 Windows 2000 Server[데스크톱 앱만]
대상 플랫폼 Windows
헤더 gdipluspath.h(Gdiplus.h 포함)
라이브러리 Gdiplus.lib
DLL Gdiplus.dll

참고 항목

경로 구성 및 그리기

GetPathData

GetPathPoints 메서드

GetPathTypes

GetPointCount

Graphicspath

GraphicsPathIterator

GraphicsPathIterator::CopyData

GraphicsPathIterator::GetCount

경로