[cairo] Rotation around a point

Donn donn.ingle at gmail.com
Sat Nov 24 11:55:51 PST 2007


> I have no idea on the API you use (I assume pycairo), but I would try to do
> something like
Yes, pycairo.

> cairo.Matrix.translate( ThingMatrix, prop.x, prop.y )
It moves to x,y
> cairo.Matrix.scale( ThingMatrix, prop.sx, prop.sy )
It gets bigger.
> cairo.Matrix.rotate( ThingMatrix, prop.rot )
It turns from some unknown point. I assume around 0,0 on the surface.
> If you add a second
> cairo.Matrix.translate( ThingMatrix, x, y ) somewhere, it should be rotated
> around this point.
This is the one I don't grok. Won't this just move it again, to some other 
x.y?

To put more context to it, I'm trying to write a simple animation API (no more 
than a prototype) so that frames and tweens are built right in. Part of that 
is being able to rotate objects (and whatever they contain) around set 
points.

I *think* you are saying rotate it and then move it to where the 
x,y "rotation" point would be. I'd have to think on it some ... maths and I 
don't talk -- I said she was too calculating and she went off in a huff :D

Thanks for the feedback.
\d


More information about the cairo mailing list