CGpGraphics.DrawClosedCurvemethod
Draws a closed cardinal spline.
Syntax
FUNCTION DrawClosedCurve (BYVAL pPen AS CGpPen PTR, BYVAL pts AS GpPointF PTR, BYVAL count AS INT_) AS GpStatus
FUNCTION DrawClosedCurve (BYVAL pPen AS CGpPen PTR, BYVAL pts AS GpPoint PTR, BYVAL count AS INT_) AS GpStatus
FUNCTION DrawClosedCurve (BYVAL pPen AS CGpPen PTR, BYVAL pts AS GpPointF PTR, BYVAL count AS INT_, BYVAL tension AS SINGLE) AS GpStatus
FUNCTION DrawClosedCurve (BYVAL pPen AS CGpPen PTR, BYVAL pts AS GpPoint PTR, BYVAL count AS INT_, BYVAL tension AS SINGLE) AS GpStatus
Parameters
| Name | Description | |
|---|---|---|
pPen | Pointer to a pen that is used to draw the closed cardinal spline. | |
pts | Pointer to an array of GpPointF objects that specify the coordinates of the closed cardinal spline. The array of GpPointF objects must contain a minimum of three elements. | |
count | Integer that specifies the number of elements in the points array. | |
tension | Single precision number that specifies how tightly the curve bends through the coordinates of the closed cardinal spline. |
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
Draws a closed cardinal spline.
Remarks
Each ending point is the starting point for the next cardinal spline. In a closed cardinal spline, the curve continues through the last point in the points array and connects with the first point in the array.
Example
' ======================================================================================== ' The following example draws a closed cardinal spline. ' ======================================================================================== SUB Example_DrawClosedCurve (BYVAL hdc AS HDC)
' // Create a graphics object from the window device context DIM graphics AS CGpGraphics = hdc ' // Set the scale transform graphics.ScaleTransformForDpi
' // Define a Pen object and an array of PointF objects. DIM greenPen AS CGpPen = ARGB_LIGHTGREEN DIM point1 AS GpPointF = (100.0, 100.0) DIM point2 AS GpPointF = (200.0, 50.0) DIM point3 AS GpPointF = (400.0, 10.0) DIM point4 AS GpPointF = (500.0, 100.0) DIM point5 AS GpPointF = (600.0, 200.0) DIM point6 AS GpPointF = (700.0, 400.0) DIM point7 AS GpPointF = (500.0, 500.0)
DIM curvePoints(6) AS GpPointF curvePoints(0) = point1 curvePoints(1) = point2 curvePoints(2) = point3 curvePoints(3) = point4 curvePoints(4) = point5 curvePoints(5) = point6 curvePoints(6) = point7
' // Draw the closed curve. graphics.DrawClosedCurve(@greenPen, @curvePoints(0), 7, 1.0)
' // Draw the points in the curve. DIM redBrush AS CGpSolidBrush = ARGB_RED graphics.FillEllipse(@redBrush, 95, 95, 10, 10) graphics.FillEllipse(@redBrush, 495, 95, 10, 10) graphics.FillEllipse(@redBrush, 495, 495, 10, 10) graphics.FillEllipse(@redBrush, 195, 45, 10, 10) graphics.FillEllipse(@redBrush, 395, 5, 10, 10) graphics.FillEllipse(@redBrush, 595, 195, 10, 10) graphics.FillEllipse(@redBrush, 695, 395, 10, 10)
END SUB ' ========================================================================================
Reference
- Include file
CGpGraphics.inc - Defined in AfxNova/CGpGraphics.inc:671
- Documented in Graphics/GdiPlus Classes/CGpGraphics Classes.md
- Topic: CGpGraphics Class