Help Center

GdipAddPathCurveIfunction

Adds a cardinal spline to the current figure of this path.

Graphicsfunctiondocumented

Syntax

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

Parameters

NameDescription
path[in] Pointer to the GraphicsPath object.
points[in] Pointer to an array of points that define the cardinal spline. The cardinal spline is a curve that passes through each point in the array.
count[in] Long integer value that specifies the number of elements in the points array.

Description

Adds a cardinal spline to the current figure of this path.

Remarks

You should keep a copy of the points array if those points will be needed later. The GraphicsPath object does not store the points passed to the GdipAddPathCurve function; instead, it converts the cardinal spline to a sequence of Bézier splines and stores the points that define those Bézier splines. You cannot retrieve the original array of points from the GraphicsPath object.

Example

' ======================================================================================== ' This example draws a cardinal spline using GdipAddPathCurve. ' ======================================================================================== SUB Example_DrawCurve (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 a GraphicsPath object and initializes the fill mode. DIM path AS GpPath PTR hStatus = GdipCreatePath(FillModeAlternate, @path)

' // Define points for the curve DIM pts(0 TO 4) AS GpPointF pts(0).x = 60 : pts(0).y = 100 pts(1).x = 120 : pts(1).y = 40 pts(2).x = 180 : pts(2).y = 100 pts(3).x = 150 : pts(3).y = 180 pts(4).x = 90 : pts(4).y = 180

' // Add cardinal spline to path hStatus = GdipAddPathCurve(path, @pts(0), 5)

' // Create pen DIM pen AS GpPen PTR hStatus = GdipCreatePen1(ARGB_TEAL, 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:2037
  • Documented in Graphics/GdiPlus Flat Api/GdiPlusGraphicsPath.md
  • Topic: GraphicsPath Functions