CGpGraphicsPath.GetPathPointsmethod
Gets this path's array of points.
Syntax
FUNCTION GetPathPoints (BYREF pts AS GpPointF PTR, BYVAL count AS INT_) AS GpStatus
Parameters
| Name | Description | |
|---|---|---|
pts | Pointer to an array of GpPointF objects that receives the data points. You must allocate memory for this array. You can call the GetPointCount method to determine the required size of the array. The size, in bytes, should be the return value of GetPointCount multiplied by SIZEOF(GpPointF). |
Return value
If the function succeeds, it returns StatusOk, which is an element of the GpStatus enumeration.
If the function fails, it returns one of the other elements of the GpStatus enumeration.
Description
Gets this path's array of points. The array contains the endpoints and control points of the lines and Bézier splines that are used to draw the path.
Remarks
A GraphicsPath object has an array of points and an array of types. Each element in the array of types is a byte that specifies the point type and a set of flags for the corresponding element in the array of points. Possible point types and flags are listed in the PathPointType enumeration.
Example
' ======================================================================================== ' The following example creates and draws a path that has a line, a rectangle, an ellipse, ' and a curve. The code calls the path's GraphicsPath::GetPointCount method to determine ' the number of data points that are stored in the path. The code allocates a buffer large ' enough to receive the array of data points and passes the address of that buffer to the ' GraphicsPath.GetPathPoints method. Finally, the code draws each of the path's data points. ' ======================================================================================== SUB Example_GetPathPoints (BYVAL hdc AS HDC)
' // Create a graphics object from the window device context DIM graphics AS CGpGraphics = hdc ' // Set the scale transform graphics.ScaleTransformForDpi
' // Create a path that has a line, a rectangle, an ellipse, and a curve. DIM path AS CGpGraphicsPath DIM points(0 TO 4) AS GpPoint = {(200, 200), (250, 240), (200, 300), (300, 310), (250, 350)}
path.AddLine(20, 100, 150, 200) path.AddRectangle(40, 30, 80, 60) path.AddEllipse(200, 30, 200, 100) path.AddCurve(@points(0), 5)
' // Draw the path DIM pen AS CGpPen = ARGB_RED graphics.DrawPath(@pen, @path)
' // Get the path points. DIM nCount AS LONG = path.GetPointCount DIM dataPoints(nCount -1) AS GpPointF path.GetPathPoints(@dataPoints(0), nCount)
' // Draw the path's data points DIM brush AS CGpSolidBrush = ARGB_RED FOR j AS LONG = 0 TO nCount - 1
graphics.FillEllipse(@brush, dataPoints(j).x - 3.0, _
dataPoints(j).y - 3.0, 6.0, 6.0)
NEXT
END SUB ' ========================================================================================
Reference
- Include file
CGpPath.inc - Defined in AfxNova/CGpPath.inc:562
- Documented in Graphics/GdiPlus Classes/CGpGraphics Classes.md
- Topic: CGpGraphics Class