描述
Draws a sequence of connected B閦ier splines.
C++ Syntax
Status DrawBeziers( [in] const Pen *pen, [in] const PointF *points, [in] INT count ); |
FreeBASIC 语法
FUNCTION DrawBeziers ( _ BYVAL pPen AS CGpPen PTR, _ BYVAL pts AS GpPointF PTR, _ BYVAL count AS INT_ _ ) AS GpStatus |
参数
pPen
[in] Pointer to a pen that is used to draw the B閦ier splines.
pts
[in] Pointer to an array of PointF objects that specify the starting, ending, and control points of the B閦ier splines.
count
[in]整数,指定的点的数组元素个数.
返回值
如果该方法成功,则返回Ok,这是对Status枚举元素.
如果这个方法失败,它返回一个枚举的其他元素的Status.
备注
A B閦ier spline does not pass through its control points. The control points act as magnets, pulling the curve in certain directions to influence the way a B閦ier spline bends. Each B閦ier spline requires a starting point and an ending point. Each ending point is the starting point for the next B閦ier spline.
引用文件
CGpBitmap.inc (include CGdiPlus.inc)
示例
' ========================================================================================
' The following example draws a pair of B閦ier curves.
' ========================================================================================
SUB Example_DrawBeziers (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 startPoint AS GpPointF : startPoint.x = 100.0 : startPoint.y = 100.0
DIM ctrlPoint1 AS GpPointF : ctrlPoint1.x = 200.0 : ctrlPoint1.y = 50.0
DIM ctrlPoint2 AS GpPointF : ctrlPoint2.x = 400.0 : ctrlPoint2.y = 10.0
DIM endPoint1 AS GpPointF : endPoint1.x = 500.0 : endPoint1.y = 100.0
DIM ctrlPoint3 AS GpPointF : ctrlPoint3.x = 600.0 : ctrlPoint3.y = 200.0
DIM ctrlPoint4 AS GpPointF : ctrlPoint4.x = 700.0 : ctrlPoint4.y = 400.0
DIM endPoint2 AS GpPointF : endPoint2.x = 500.0 : endPoint2.y = 500.0
DIM curvePoints(6) AS GpPointF
curvePoints(0) = startPoint
curvePoints(1) = ctrlPoint1
curvePoints(2) = ctrlPoint2
curvePoints(3) = endPoint1
curvePoints(4) = ctrlPoint3
curvePoints(5) = ctrlPoint4
curvePoints(6) = endPoint2
' // Draw the Bezier curves.
graphics.DrawBeziers(@greenPen, @curvePoints(0), 7)
' // Draw the control and end points.
DIM redBrush AS CGpSolidBrush = GDIP_ARGB(255, 255, 0, 0)
graphics.FillEllipse(@redBrush, 100 - 5, 100 - 5, 10, 10)
graphics.FillEllipse(@redBrush, 500 - 5, 100 - 5, 10, 10)
graphics.FillEllipse(@redBrush, 500 - 5, 500 - 5, 10, 10)
DIM blueBrush AS CGpSolidBrush = GDIP_ARGB(255, 0, 0, 255)
graphics.FillEllipse(@blueBrush, 200 - 5, 50 - 5, 10, 10)
graphics.FillEllipse(@blueBrush, 400 - 5, 10 - 5, 10, 10)
graphics.FillEllipse(@blueBrush, 600 - 5, 200 - 5, 10, 10)
graphics.FillEllipse(@blueBrush, 700 - 5, 400 - 5, 10, 10)
END SUB
' ========================================================================================


