GdipAddPathClosedCurve2Ifunction
Adds a closed cardinal spline to this path.
Syntax
FUNCTION GdipAddPathClosedCurve2I (BYVAL path AS GpPath PTR, BYVAL points AS CONST GpPoint PTR, BYVAL count AS INT_, BYVAL tension AS REAL) AS GpStatus
GdipAddPathClosedCurve2 — one description covers them all.Parameters
| Name | Description | |
|---|---|---|
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. | |
tension | [in] Nonnegative simple precision value that controls the length of the curve and how the curve bends. A value of 0 specifies that the spline is a sequence of straight line segments. As the value increases, the curve becomes fuller. |
Description
Adds a closed cardinal spline to 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 GdipAddPathClosedCurve2 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 closed cardinal spline with adjustable tension. ' ======================================================================================== SUB Example_DrawClosedCurve2 (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 closed 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 closed curve with tension DIM tension AS SINGLE = 0.5 hStatus = GdipAddPathClosedCurve2(path, @pts(0), 5, tension)
' // Create pen DIM pen AS GpPen PTR hStatus = GdipCreatePen1(ARGB_ORANGE, 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:2042
- Documented in Graphics/GdiPlus Flat Api/GdiPlusGraphicsPath.md
- Topic: GraphicsPath Functions