First, see the wikipedia page on transformation matrices. That should help with the terminology. Next, understand that there are two matrices involved at any given time.
- The "prime" matrix
- The "item" matrix
The prime matrix usually starts out as a bunch of zeros and a one:
[0 0 0]
[0 0 0]
[0 0 1]
This means do nothing. Next the item's matrix is determined. Once it's time to start laying things onto the device, then these two matrices are combined with an affine transformation.
This transformation gives you a point off of the starting position to draw your item, with any appropriate scaling or rotation.
Since the prime matrix is used across all of the items, we can adjust it to have some universal effect. Say we want to shift everything "left" 50 points. You're lucky in that you wouldn't have to manually set your matrix to do this, just call cairo_translate(cr, -50, 0)
or something similar.
Now every new item rendered will be modified.
*cr
, and runcairo_rotate(cr, your_angle)
. This will update the matrix you gave it to the new value. If you have already determined what the matrix should be, then you would callcairo_set_matrix(cr, new_cr)
. – Spencer Rathbun Jun 18 '12 at 17:24*cr
is what the docs you linked to uses in the example. In general*
means pointer, andcr
is just a var name. I assume that means they want your pointer to the appropriate matrix. See here for details on pointers. – Spencer Rathbun Jun 18 '12 at 17:33