Current Transform Matrix

Learn about the current transformation matrix in Pycairo.

We'll cover the following

CTM

Under the hood, Pycairo uses a matrix to calculate the transformations. This is called the current transform matrix (CTM) and forms part of the Context object.

Initially, the CTM is set to a unit matrix that corresponds to a one-to-one mapping. The translate, scale, and rotate operations update the CTM. The effect is cumulative so, for example, if you apply a translate followed by a rotate, the value of the CTM will reflect the combined operation.

The diagram below shows how this process works:

Get hands-on with 1400+ tech skills courses.