다음을 통해 공유


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 개체를 만들고 경로에 세 줄을 추가합니다. 이 코드는 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 포함)
라이브러리 Gdiplus.lib
DLL Gdiplus.dll

참고 항목

경로 구성 및 그리기

GetPathData

GetPathPoints 메서드

GetPathTypes

GetPointCount

Graphicspath

GraphicsPathIterator

GraphicsPathIterator::Enumerate

GraphicsPathIterator::GetCount

경로