描述
绘制闭基数样条.
C++ Syntax
Status DrawClosedCurve( [in] const Pen *pen, [in] const PointF *points, [in] INT count ); |
Status DrawClosedCurve( [in] const Pen *pen, [in] const Point *points, [in] INT count ); |
Status DrawClosedCurve( [in] const Pen *pen, [in] const PointF *points, [in] INT count, [in] REAL tension ); |
Status DrawClosedCurve( [in] const Pen *pen, [in] const Point *points, [in] INT count, [in] REAL tension ); |
FreeBASIC 语法
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 |
参数
pPen
[in]指针的那一支钢笔是用来绘制闭合的基数样条曲线.
pts
[in]指针到指定的对象PointF闭合的基数样条曲线的坐标数组.对PointF对象数组必须包含至少三个元素.
count
[in]整数,指定的点的数组元素个数.
tension
[in]简单精度数,指定如何紧密的曲线弯曲的闭合的基数样条曲线的坐标.
返回值
如果该方法成功,则返回Ok,这是对Status枚举元素.
如果这个方法失败,它返回一个枚举的其他元素的Status.
备注
每个结束点是下一个基数样条的起点.在封闭的基数样条曲线中,曲线继续通过点数组中的最后一点,并与数组中的第一个点连接.
引用文件
CGpBitmap.inc (include CGdiPlus.inc)
示例
' ========================================================================================
' 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
' // Get the DPI scaling ratio
DIM rxRatio AS SINGLE = graphics.GetDpiX / 96
DIM ryRatio AS SINGLE = graphics.GetDpiY / 96
' // Set the scale transform
graphics.ScaleTransform(rxRatio, ryRatio)
' // Define a Pen object and an array of PointF objects.
DIM greenPen AS CGpPen = GDIP_ARGB(255, 0, 255, 0)
DIM point1 AS GpPointF : point1.x = 100.0 : point1.y = 100.0
DIM point2 AS GpPointF : point2.x = 200.0 : point2.y = 50.0
DIM point3 AS GpPointF : point3.x = 400.0 : point3.y = 10.0
DIM point4 AS GpPointF : point4.x = 500.0 : point4.y = 100.0
DIM point5 AS GpPointF : point5.x = 600.0 : point5.y = 200.0
DIM point6 AS GpPointF : point6.x = 700.0 : point6.y = 400.0
DIM point7 AS GpPointF : point7.x = 500.0 : point7.y = 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 = GDIP_ARGB(255, 255, 0, 0)
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
' ========================================================================================


