[cairo] save/restore guidelines?
Ian Britten
britten at caris.com
Fri Aug 15 04:58:46 PDT 2008
Owen Taylor wrote:
>> I'm sortof familiar with the save/restore idiom when drawing,
>> from some previous work with PostScript. I see that Cairo
>> provides this mechanism, and was wondering if anyone had any
>> guidelines about when (or when not) to use it?
>
> There are also some more esoteric uses. E.g., to take advantage
> of the fact that save/restore don't affect the current path.
Hmmm... I didn't know that. I'll have to keep that in mind as
I get further immersed into Cairo...
>
[ Interesting example snipped ]
> save/restore is essential when using cairo to draw things directly.
> If you are wrapping cairo in a non-cairo API then it may not be
> so useful since the non-cairo API will already be doing the work
> of tracking all the state.
Ya, that's the impression I was starting to get. Given our existing
framework is based on established stateless graphics techniques
(WIN32, GTK, WX, etc), then pretty much everything fully qualifies
its state when it needs to draws.
Thanks for the helpful info! And keep up the great work!
Ian
More information about the cairo
mailing list