# [cairo] Cairo Fill Rule - Alternate

Wed Oct 24 21:48:21 PDT 2012

```Hi Bill,

Yes, I want the same that is mentioned by you.

I looked at MSDN GDI functionality at
http://msdn.microsoft.com/en-us/library/windows/desktop/dd145080(v=vs.85).aspx
It lists out ALTERNATE
Selects alternate mode (fills the area between odd-numbered and
even-numbered polygon sides on each scan line).

But in Cairo, we don't have any similar functionality.
Cairo lists fill rule as : 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)

Please see if something can be done, so that we have similar feature
in Cairo too.

Regards,

On Tue, Oct 23, 2012 at 7:49 PM, Bill Spitzak <spitzak at gmail.com> wrote:
> 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
>
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
```