GraphicsPathIterator::NextSubpath(constGraphicsPath*,BOOL*) 메서드(gdipluspath.h)

GraphicsPathIterator::NextSubpath 메서드는 이 반복기의 연결된 경로에서 다음 그림(하위 경로)을 가져옵니다.

구문

INT NextSubpath(
  [out] const GraphicsPath *path,
  [out] BOOL               *isClosed
);

매개 변수

[out] path

형식: GraphicsPath*

GraphicsPath 개체에 대한 포인터입니다. 이 메서드는 검색된 그림의 데이터 요소와 일치하도록 이 GraphicsPath 개체의 데이터 요소를 설정합니다.

[out] isClosed

형식: BOOL*

검색된 그림이 닫혀 있는지 여부를 나타내는 값을 받는 BOOL 에 대한 포인터입니다. 그림이 닫힌 경우 수신된 값은 TRUE이고, 그렇지 않으면 받은 값이 FALSE입니다.

반환 값

형식: INT

이 메서드는 검색된 그림의 데이터 포인트 수를 반환합니다. 검색할 그림이 더 이상 없으면 이 메서드는 0을 반환합니다.

설명

반복 기의 GraphicsPathIterator::NextSubpath 메서드를 처음 호출할 때 해당 반복기의 연결된 경로의 첫 번째 그림(하위 경로)을 가져옵니다. 두 번째로 두 번째 그림 등을 가져옵니다. GraphicsPathIterator::NextSubpath를 호출할 때마다 검색된 그림의 데이터 요소 수를 반환합니다. 남은 수치가 없으면 0을 반환합니다.

예제

다음 예제에서는 GraphicsPath 개체를 만들고 5개의 그림(하위 경로라고도 함)을 경로에 추가합니다. 이 코드는 GraphicsPath 개체의 주소를 GraphicsPathIterator 생성자에 전달하여 경로와 연결된 반복기를 만듭니다. 이 코드는 반복기의 GraphicsPathIterator::NextSubpath 메서드를 두 번 호출하여 경로에서 두 번째 그림(하위 경로)을 검색합니다. 그런 다음, 코드는 Graphics 개체의 DrawPath 메서드를 호출하여 해당 개별 하위 경로를 그립니다.


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

   // Create a graphics path with five figures (subpaths).
   GraphicsPath path;

   path.AddRectangle(Rect(20, 20, 60, 30));   // Subpath count is 1.

   path.AddLine(100, 20, 160, 50);            // Subpath count is 2.
   path.AddArc(180, 20, 60, 30, 0.0f, 180.0f);

   path.AddRectangle(Rect(260, 20, 60, 30));  // Subpath count is 3.

   path.AddLine(340, 20, 400, 50);            // Subpath count is 4.
   path.AddArc(340, 20, 60, 30, 0.0f, 180.0f);
   path.CloseFigure();
  
   path.AddRectangle(Rect(420, 20, 60, 30));  // Subpath count is 5.
 
   // Create an iterator, and associate it with the path.
   GraphicsPathIterator iterator(&path);

   // Get the second subpath by calling NextSubpath twice.
   GraphicsPath subpath;
   BOOL isClosed;
   INT count;
   count = iterator.NextSubpath(&subpath, &isClosed);
   count = iterator.NextSubpath(&subpath, &isClosed);

   // The variable "count" now holds the number of 
   // data points in the second subpath.

   // Draw the retrieved subpath.
   Pen bluePen(Color(255, 0, 0, 255));
   graphics.DrawPath(&bluePen, &subpath);
}

요구 사항

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

참고 항목

경로 구성 및 그리기

GetPathData

Graphicspath

GraphicsPathIterator

GraphicsPathIterator::GetSubpathCount

GraphicsPathIterator::NextMarker 메서드

NextSubpath

경로