[cairo] Cairo Fill Rule - Alternate

Uli Schlachter psychon at znc.in
Tue Oct 23 01:26:00 PDT 2012


On 22.10.2012 12:57, Adhir Garg wrote:
> This is about CAIRO fill rule.
> Currently we have 2 rules for filling in cairo. From the manual
> http://www.cairographics.org/manual/cairo-cairo-t.html#CAIRO-FILL-RULE-WINDING:CAPS
> Counts the total number of intersections, without regard to the
> orientation of the contour. If the total number of intersections is
> odd, the point will be filled. (Since 1.0)
> We don't have the way to "fill" in using the ALTERNATE rules i.e. if
> we have Triangle (Polygon of length 3) inside Rectangle (Polygon of
> length 4) and we want to fill in the area between Rectangle and
> Triangle. From initial thoughts, EVEN_ODD was probably the same, but
> it revealed (being similar to SVG) that it fills depending on the
> intersections and not on the difference in sides of polygon.

I don't really get your problem (nor do I get what the difference between
"intersections" and "sides" would be). Could you elaborate?

If you want to draw the difference between a rectangle and a triangle, you can
do so with both fill rules. But more easily you can do so with the even-odd
rule. It should Just Work (tm). Do you have any (self contained) example code of
what you are trying to do that gets the wrong result?

Bitte nicht mit dem verbleibenden Auge in den Laser gucken.
 - Vincent Ebert

More information about the cairo mailing list