Drawing Paths

Using bezier paths.


Create a new path.

drawBot.moveTo((x, y))

Move to a point x, y.

drawBot.lineTo((x, y))

Line to a point x, y.

drawBot.curveTo((x1, y1), (x2, y2), (x3, y3))

Curve to a point x3, y3. With given bezier handles x1, y1 and x2, y2.

drawBot.arcTo((x1, y1), (x2, y2), radius)

Arc from one point to an other point with a given radius.


Close the path.


Draw the current path, or draw the provided path.

# create a new empty path
# set the first oncurve point
moveTo((100, 100))
# line to from the previous point to a new point
lineTo((100, 200))
lineTo((200, 200))

# curve to a point with two given handles
curveTo((200, 100), (150, 100), (100, 100))

# close the path
# draw the path

Use the current path as a clipping path. The clipping path will be used until the canvas gets a restore().

# create a bezier path
path = BezierPath()

# move to a point
path.moveTo((100, 100))
# line to a point
path.lineTo((100, 200))
path.lineTo((200, 200))
# close the path
# set the path as a clipping path
# the oval will be clipped inside the path
oval(100, 100, 100, 100)