CGpGraphicsPath.GetPathDatamethod
Gets an array of points and an array of point types from this path.
Syntax
FUNCTION GetPathData (BYVAL pPathData AS GpPathData PTR) AS GpStatus
Parameters
| Name | Description | |
|---|---|---|
pPathData | Pointer to a PathData structure that receives the path data. The Points data member of the PathData structure receives a pointer to an array of GpPointF objects that contains the path points. The Types data member of the PathData structure receives a pointer to an array of bytes that contains the point types. The Count data member of the PathData structure receives an integer that indicates the number of elements in the Points array. |
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 an array of points and an array of point types from this path. Together, these two arrays define the lines, curves, figures, and markers of this path.
Example
' ======================================================================================== ' The following example creates and draws a path that has a line, a rectangle, an ellipse, ' and a curve. The code gets the path's points and types by passing the address of a PathData ' structure to the GraphicsPath.GetPathData method. Then the code draws each of the path's data points. ' ======================================================================================== SUB Example_GetPathData (BYVAL hdc AS HDC)
' // Create a graphics object from the window device context DIM graphics AS CGpGraphics = hdc ' // Set the scale transform graphics.ScaleTransformForDpi
DIM points(0 TO 4) AS GpPoint = {(200, 200), (250, 240), (200, 300), (300, 310), (250, 350)} DIM path AS CGpGraphicsPath 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_BLUE graphics.DrawPath(@pen, @path)
' // Get the path data DIM pathData AS GDIP_PATHDATA path.GetPathData(@pathData)
' // Draw the path's data points DIM brush AS CGpSolidBrush = ARGB_RED FOR j AS LONG = 0 TO pathData.Count - 1
graphics.FillEllipse(@brush, pathData.Points[j].x - 3.0, _
pathData.Points[j].y - 3.0, 6.0, 6.0)
NEXT
END SUB ' ========================================================================================
Reference
- Include file
CGpPath.inc - Defined in AfxNova/CGpPath.inc:97
- Documented in Graphics/GdiPlus Classes/CGpGraphics Classes.md
- Topic: CGpGraphics Class