GraphicsPath.AddCurveToPoint
From Xojo Documentation
Method
This method is only available on platform. For cross-platform compatibility, use #If...#Endif with the Target... specifiers to make sure you will not attempt to use this method on an incompatible platform. |
GraphicsPath.AddCurveToPoint(cp1x As Double, cp1y As Double, cp2X As Double, cp2Y As Double, x As Double, y As Double)
New in 2019r2
Supported for all project types and targets.
New in 2019r2
Supported for all project types and targets.
Adds a cubic Bézier curve to the point in the path.
Parameters
Value | Description |
---|---|
cp1x | The x-coordinate of the first control point. |
cp1y | The y-coordinate of the first control point. |
cp2x | The x-coordinate of the second control point. |
cp2y | The y-coordinate of the second control point. |
x | The x-coordinate of the end point of the curve. |
y | The y-coordinate of the end point of the curve. |
Sample Code
Draw a cloud:
Var curve As New GraphicsPath
curve.MoveToPoint(20, 20)
curve.AddCurveToPoint(20, 100, 200, 100, 200, 20)
g.DrawPath(curve)
// Draw a fluffy white cloud
Var cloud As New GraphicsPath
cloud.MoveToPoint(170, 80)
cloud.AddCurveToPoint(130, 100, 130, 150, 230, 150)
cloud.AddCurveToPoint(250, 180, 320, 180, 340, 150)
cloud.AddCurveToPoint(420, 150, 420, 120, 390, 100)
cloud.AddCurveToPoint(430, 40, 370, 30, 340, 50)
cloud.AddCurveToPoint(320, 5, 250, 20, 250, 50)
cloud.AddCurveToPoint(200, 5, 150, 20, 170, 80)
g.DrawingColor = &c0000FF
g.PenSize = 5
g.DrawPath(cloud)
curve.MoveToPoint(20, 20)
curve.AddCurveToPoint(20, 100, 200, 100, 200, 20)
g.DrawPath(curve)
// Draw a fluffy white cloud
Var cloud As New GraphicsPath
cloud.MoveToPoint(170, 80)
cloud.AddCurveToPoint(130, 100, 130, 150, 230, 150)
cloud.AddCurveToPoint(250, 180, 320, 180, 340, 150)
cloud.AddCurveToPoint(420, 150, 420, 120, 390, 100)
cloud.AddCurveToPoint(430, 40, 370, 30, 340, 50)
cloud.AddCurveToPoint(320, 5, 250, 20, 250, 50)
cloud.AddCurveToPoint(200, 5, 150, 20, 170, 80)
g.DrawingColor = &c0000FF
g.PenSize = 5
g.DrawPath(cloud)