On Mon, 5 Nov 2007 17:38:19 +0200, Donn wrote: > Hi, not sure if this is the appropriate list.
Yes, definitely the right list. Welcome, Donn! > Can one, within a single cairo context, do this: > > while True: > ctx.translate(0,0) > <pycairo commands to draw a square at 0,0> > ctx.translate(10,10) > <pycairo commands to draw a circle at 0,0> > ctx.translate(50,50) > <pycairo commands to draw a Black Night at 11,44> Absolutely! > The idea is to keep all the <drawing commands> relative to 0,0 and use > translate (and scale etc later) to actually move the results around the > canvas. That's a good model to use, and cairo supports it quite well. > At the moment my tests are all over the place. Is there a way to reset the > overall transform between each <> section? What you're looking for is save/restore, like so: ctx.save() ctx.translate() scale.scale() draw_something() ctx.restore() Often I will code all of my draw_something functions to also call save() at the beginning and restore() at the end, which helps them to act idempotently, (things like change to the source pattern won't accidentally leak out, for example). I hope that helps. And have fun with cairo! -Carl
pgpmQpfQmjKn6.pgp
Description: PGP signature
_______________________________________________ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/