[Cairo] py-cairo example & Context save/restore quesiton

Carl Worth cworth at east.isi.edu
Fri Nov 14 11:04:14 PST 2003

On Nov 14, Jesse David Andrews wrote:
 > Very interesting that saving/restoring also can wipe out the path.  I find
 > it a little bizaire...  Any reasons behind it (I guess I am used to coding
 > in postscript where this is NOT the behavor of save/restore and cannot
 > think of where saving/restoring the path would be more useful...)

PostScript compatibility is actually the reason behind it. My reading
of the PS reference manual suggests that the path is part of the
graphics state.

 > Regardless, in terms of what I am trying to do:
 > will:
 >   forward
 >   save
 >   forward
 >   stroke
 >   restore
 >   forward
 >   stroke
 > work?

Not quite. You would get the basic shape you want, but the first
"forward" part of the path would be drawn twice. This will result in
the wrong values along the anti-aliased edges, (even easier to see the
problem after something like cairo_set_alpha (cr, 0.5)).

The easiest way to get a good looking shape without seams is to
construct the entire path and draw it with a single stroke operation.


More information about the cairo mailing list