CGpGraphicsPath.AddCurvemethod
Adds a cardinal spline to this path.
Syntax
FUNCTION AddCurve (BYVAL pts AS GpPointF PTR, BYVAL nCount AS INT_) AS GpStatus
FUNCTION AddCurve (BYVAL pts AS GpPoint PTR, BYVAL nCount AS INT_) AS GpStatus
FUNCTION AddCurve (BYVAL pts AS GpPointF PTR, BYVAL nCount AS INT_, BYVAL tension AS SINGLE) AS GpStatus
FUNCTION AddCurve (BYVAL pts AS GpPoint PTR, BYVAL nCount AS INT_, BYVAL tension AS SINGLE) AS GpStatus
FUNCTION AddCurve (BYVAL pts AS GpPointF PTR, BYVAL nCount AS INT_, BYVAL offset AS INT_, BYVAL numberOfSegments AS INT_, BYVAL tension AS SINGLE) AS GpStatus
FUNCTION AddCurve (BYVAL pts AS GpPoint PTR, BYVAL nCount AS INT_, BYVAL offset AS INT_, BYVAL numberOfSegments AS INT_, BYVAL tension AS SINGLE) AS GpStatus
Parameters
| Name | Description | |
|---|---|---|
pts | 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 | Integer that specifies the number of elements in the pts array. | |
offset | Integer that specifies the index of the array element that is used as the first point of the cardinal spline. | |
numberOfSegments | Integer that specifies the number of segments in the cardinal spline. Segments are the curves that connect consecutive points in the array. | |
tension | Nonnegative single precision number 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. |
Return value
If the function succeeds, it returns StatusOk, which is an element of the GpStatus enumeration.
If the function fails, it returns one of the other elements of the GpStatus enumeration.
Description
Adds a cardinal spline to this path.
Examples
' ======================================================================================== ' The following example creates a GraphicsPath object path, adds a cardinal spline to path, ' and then draws path. ' ======================================================================================== SUB Example_AddCurve (BYVAL hdc AS HDC)
' // Create a graphics object from the window device context DIM graphics AS CGpGraphics = hdc ' // Set the scale transform graphics.ScaleTransformForDpi
DIM pts(0 TO 3) AS GpPoint = {(50, 50), (60, 20), (70, 100), (80, 50)} DIM path AS CGpGraphicsPath path.AddCurve(@pts(0), 4)
' // Draw the path DIM pen AS CGpPen = ARGB_RED graphics.DrawPath(@pen, @path)
END SUB ' ========================================================================================
' ======================================================================================== ' The following example creates a GraphicsPath object path, adds a cardinal spline to path, ' and then draws path. ' ======================================================================================== SUB Example_AddCurve (BYVAL hdc AS HDC)
' // Create a graphics object from the window device context DIM graphics AS CGpGraphics = hdc ' // Set the scale transform graphics.ScaleTransformForDpi
DIM path AS CGpGraphicsPath DIM pts(0 TO 7) AS GpPoint = {GDIP_POINT(50, 50), GDIP_POINT(70, 80), GDIP_POINT(100, 100), _
GDIP_POINT(130, 40), GDIP_POINT(150, 90), GDIP_POINT(180, 30), GDIP_POINT(210, 120), GDIP_POINT(240, 80)}
path.AddCurve(@pts(0), 8, 2, 4, 1.0)
DIM path AS CGpGraphicsPath DIM pts(0 TO 7) AS GpPoint = {(50, 50), (70, 80), (100, 100), _
(130, 40), (150, 90), (180, 30), (210, 120), (240, 80)}
path.AddCurve(@pts(0), 8, 2, 4, 1.0)
DIM pen AS CGpPen = ARGB_BLUE graphics.DrawPath(@pen, @path)
' // Draw all eight points in the array. DIM brush AS CGpSolidBrush = ARGB_RED
FOR j AS LONG = 0 TO 7
graphics.FillEllipse(@brush, pts(j).x - 3, pts(j).y - 3, 6, 6)
NEXT
END SUB ' ========================================================================================
Reference
- Include file
CGpPath.inc - Defined in AfxNova/CGpPath.inc:274
- Documented in Graphics/GdiPlus Classes/CGpGraphics Classes.md
- Topic: CGpGraphics Class