GdipGetPathDatafunction
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.
Syntax
FUNCTION GdipGetPathData (BYVAL path AS GpPath PTR, BYVAL pathData AS GpPathData PTR) AS GpStatus
Parameters
| Name | Description | |
|---|---|---|
path | [in] Pointer to the GraphicsPath object. | |
pathData | [out] Pointer to a GpPathData structure that receives the path data. The Points data member of the GpPathData structure receives a pointer to an array of GpPointF structures that contains the path points. The Types data member of the GpPathData structure receives a pointer to an array of bytes that contains the point types. The Count data member of the GpPathData structure receives an integer that indicates the number of elements in the Points array. |
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
' ======================================================================================== ' This example extracts the points and types from a GraphicsPath using GdipGetPathData. ' ======================================================================================== SUB Example_GetPathData (BYVAL hdc AS HDC)
DIM hStatus AS LONG
' // Create a graphics object from the device context DIM graphics AS GpGraphics PTR hStatus = GdipCreateFromHDC(hdc, @graphics)
' // Get the DPI scaling ratios DIM dpiX AS SINGLE hStatus = GdipGetDpiX(graphics, @dpiX) DIM rxRatio AS SINGLE = dpiX / 96 DIM dpiY AS SINGLE hStatus = GdipGetDpiY(graphics, @dpiY) Dim ryRatio AS SINGLE = dpiY / 96 ' // Set the scale transform hStatus = GdipScaleWorldTransform(graphics, rxRatio, ryRatio, MatrixOrderPrepend)
' // Create GraphicsPath DIM path AS GpPath PTR hStatus = GdipCreatePath(FillModeAlternate, @path)
' // Add a shape hStatus = GdipAddPathRectangle(path, 100, 80, 150, 100)
' // Get point count DIM count AS LONG GdipGetPointCount(path, @count)
' // Allocate memory for points and types DIM pts(ANY) AS GpPointF DIM types(ANY) AS BYTE REDIM pts(count - 1) REDIM types(count - 1)
' // Fill the GpPathData structure DIM pathData AS GpPathData pathData.Count = count pathData.Points = @pts(0) pathData.Types = @types(0)
' // Retrieve path data hStatus = GdipGetPathData(path, @pathData) ' // Print the data FOR i AS LONG = 0 TO pathData.Count - 1
OutputDebugStringW("Point " & WSTR(i) & ": (" & WSTR(pathData.Points[i].x) & ", " & WSTR(pathData.Points[i].y))
OutputDebugStringW("Type " & WSTR(i) & ": " & WSTR(pathData.Types[i]))
NEXT
' // Create pen DIM pen AS GpPen PTR hStatus = GdipCreatePen1(ARGB_ORANGE, 2, UnitWorld, @pen)
' // Draw the path hStatus = GdipDrawPath(graphics, pen, path)
' // Cleanup IF pen THEN GdipDeleteBrush(pen) IF path THEN GdipDeletePath(path) IF graphics THEN GdipDeleteGraphics(graphics)
END SUB ' ========================================================================================
Reference
- Defined in AfxNova/AfxGdiPlus.bi:1996
- Documented in Graphics/GdiPlus Flat Api/GdiPlusGraphicsPath.md
- Topic: GraphicsPath Functions