[cairo] Path Holes

Carl Worth cworth at cworth.org
Wed Jul 30 14:31:49 PDT 2008


On Mon, 2008-07-28 at 18:50 +0100, Bill Spitzak wrote:
> This is really useful so that your path can be a bunch of disconnected 
> shapes that *may* overlap. The other popular fill method is even/odd, in 
> that case the point is in the interior if the sum calculated above is 
> odd. Many software renderers do this because it is easy, but it is 
> useless for drawing a shape that contains overlapping parts as the xor 
> effect is not wanted.

And note that cairo does provide both methods. The default is the
winding rule (CAIRO_FILL_RULE_WINDING), but you can also use:

	cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);

to get the even-odd rule instead.

The only concrete proposals I've heard for other modes are the inverses
of each of these, (which would invert the notions of inside and
outside). That effect can already be achieved in a somewhat-awkward way
by adding an outer rectangle to the path, (as large as the current clip
extents).

-Carl





More information about the cairo mailing list