GdipAddPathBeziersfunction
Adds a Bézier spline to the current figure of this path.
Syntax
FUNCTION GdipAddPathBeziers (BYVAL path AS GpPath PTR, BYVAL points AS CONST GpPointF PTR, BYVAL count AS INT_) AS GpStatus
GdipAddPathBeziersI — one description covers them all.Parameters
| Name | Description | |
|---|---|---|
path | [in] Pointer to the GraphicsPath object. | |
points | [in] Pointer to an array of starting points, ending points, and control points for the connected splines. The first spline is constructed from the first point through the fourth point in the array and uses the second and third points as control points. Each subsequent spline in the sequence needs exactly three more points: the ending point of the previous spline is used as the starting point, the next two points in the sequence are control points, and the third point is the ending point. | |
count | [in] Long integer value that specifies the number of elements in the points array. |
Description
Adds a Bézier spline to the current figure of this path.
Example
' ======================================================================================== ' This example draws a sequence of Bézier curves using GdipAddPathBeziers. ' ======================================================================================== SUB Example_DrawBeziers (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)
' // Define points for two connected Bézier curves DIM pts(0 TO 7) AS GpPointF pts(0).x = 30 : pts(0).y = 150 ' Start point pts(1).x = 80 : pts(1).y = 50 ' Control 1 pts(2).x = 130 : pts(2).y = 250 ' Control 2 pts(3).x = 180 : pts(3).y = 150 ' End of first curve
pts(4).x = 230 : pts(4).y = 50 ' Control 1 of second pts(5).x = 280 : pts(5).y = 250 ' Control 2 of second pts(6).x = 330 : pts(6).y = 150 ' End of second curve
' // Add connected Bézier curves hStatus = GdipAddPathBeziers(path, @pts(0), 7)
' // Create pen DIM pen AS GpPen PTR hStatus = GdipCreatePen1(ARGB_GREEN, 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:2010
- Documented in Graphics/GdiPlus Flat Api/GdiPlusGraphicsPath.md
- Topic: GraphicsPath Functions