# [cairo] Cairo Fill Rule - Alternate

Bill Spitzak spitzak at gmail.com
Tue Oct 23 07:19:21 PDT 2012

```Is it possible he thinks even/odd means that the number of sides of the polygon is important?

Though I can't imagine a reason that would be wanted.

On Oct 23, 2012, at 1:26 AM, Uli Schlachter wrote:

> Hi,
>
> 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
>> (1) CAIRO_FILL_RULE_WINDING
>> (2) CAIRO_FILL_RULE_EVEN_ODD
>> 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?
>
> Cheers,
> Uli
> --
> Bitte nicht mit dem verbleibenden Auge in den Laser gucken.
> - Vincent Ebert
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo

```