[cairo] Re: 2 clipping questions

Behdad Esfahbod behdad at behdad.org
Thu Apr 26 11:11:19 PDT 2007


On Thu, 2007-04-26 at 13:44 -0400, Carl Worth wrote:
> 
>   1. Using the even-odd fill rule:
> 
>         cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
>         cairo_rectangle (cr, 200, 200, 600, 600);
>         cairo_rectangle (cr, 400, 400, 200, 200);
>         cairo_clip (cr);
> 
>   2. Using the winding fill rule (which is also the default):
> 
>         cairo_set_fill_rule (cr, CAIRO_FILL_RULE_WINDING);
>         cairo_rectangle (cr, 200, 200, 600, 600);
>         cairo_rectangle (cr, 400, 600, -200, 200);
>         cairo_clip (cr);


The beauty of number 2 above is that it works with either fill rules.

-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759





More information about the cairo mailing list