Help Center

GdipGetPathPointsIfunction

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.

Graphicsfunctiondocumented

Syntax

FUNCTION GdipGetPathPointsI (BYVAL path AS GpPath PTR, BYVAL points AS GpPoint PTR, BYVAL count AS INT_) AS GpStatus
Also documented as GdipGetPathPoints — one description covers them all.

Parameters

NameDescription
path[in] Pointer to the GraphicsPath object.
points[out] Pointer to an array of GpPointF structures that receives the data points. You must allocate memory for this array. You can call the GdipGetPointCount function to determine the required size of the array. The size, in bytes, should be the return value of GdipGetPointCount multiplied by sizeof(GpPointF).
count[in] Long integer value that specifies the number of elements in the points array. Set this parameter equal to the return value of the GdipGetPointCount function.

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.

Example

' ======================================================================================== ' This example extracts the points from a GraphicsPath using GdipGetPathPoints. ' ======================================================================================== SUB Example_GetPathPoints (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 number of points DIM count AS LONG hStatus = GdipGetPointCount(path, @count)

' // Allocate array for points DIM pts(ANY) AS GpPointF REDIM pts(count - 1)

' // Retrieve points hStatus = GdipGetPathPoints(path, @pts(0), count)

' // Display points FOR i AS LONG = 0 TO count - 1

OutputDebugStringW("Point " & WSTR(i) & ": (" & WSTR(pts(i).x) & ", " & WSTR(pts(i).y) & ")")

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:1993
  • Documented in Graphics/GdiPlus Flat Api/GdiPlusGraphicsPath.md
  • Topic: GraphicsPath Functions