다음을 통해 공유


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

배열의 요소 수를 지정하는 정수입니다. 이 매개 변수를 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 포함)
라이브러리 Gdiplus.lib
DLL Gdiplus.dll

참고 항목

지역을 사용하여 클리핑

경로 구성 및 그리기

경로 그라데이션 만들기

Graphicspath

GraphicsPath::GetPathData

GraphicsPath::GetPathTypes

GraphicsPath::GetPointCount

PathData

PathPointType

경로

Point