Help Center

GdipCreatePath2Ifunction

Creates a **GraphicsPath** object and initializes the fill mode.

Graphicsfunctiondocumented

Syntax

FUNCTION GdipCreatePath2I (BYVAL points AS CONST GpPoint PTR, BYVAL types AS CONST BYTE PTR, BYVAL count AS INT_, BYVAL fillMode AS GpFillMode, BYVAL path AS GpPath PTR PTR) AS GpStatus
Also documented as GdipCreatePath2 — one description covers them all.

Parameters

NameDescription
points[in] Pointer to an array of points that specifies the endpoints and control points of the lines and Bezier splines that are used to draw the path.
types[in] Pointer to an array of bytes that holds the point type and a set of flags for each point in the points array. The point type is stored in the three least significant bits, and the flags are stored in the four most significant bits. Possible point types and flags are listed in the PathPointType enumeration.
count[in] Long integer value that specifies the number of elements in the points array. This is the same as the number of elements in the types array.
fillMode[in] Element of the FillMode enumeration that specifies how areas are filled if the path intersects itself. The default value is FillModeAlternate.
path[out] Pointer to a variable that receives a pointer to the new GraphicsPath object.

Description

Creates a GraphicsPath object and initializes the fill mode.

Example

' ======================================================================================== ' This example creates a GraphicsPath using GdipCreatePath2 with custom points and types. ' ======================================================================================== SUB Example_CreatePath2 (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)

' // Define points DIM pts(0 TO 2) AS GpPointF pts(0).x = 100 : pts(0).y = 100 ' Start pts(1).x = 200 : pts(1).y = 100 ' Line pts(2).x = 200 : pts(2).y = 200 ' Line

' // Define types DIM types(0 TO 2) AS BYTE types(0) = PathPointTypeStart types(1) = PathPointTypeLine types(2) = PathPointTypeLine OR PathPointTypeCloseSubpath

' // Create path from raw data DIM path AS GpPath PTR hStatus = GdipCreatePath2(@pts(0), @types(0), 3, FillModeAlternate, @path)

' // Create pen DIM pen AS GpPen PTR hStatus = GdipCreatePen1(ARGB_MAROON, 2, UnitWorld, @pen)

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