Rotation

Learn about rotation in Pycairo, in this lesson.

We'll cover the following...

Rotating user space

Rotation turns the user coordinate system, through a fixed angle about the origin. We can use this to draw shapes at different orientations, without changing the drawing code.

We use the rotate method of the Context to perform the rotation:

ctx.rotate(math.pi/6)
ctx.rectangle(300, 200, 200, 100)

After rotating by ...