Re: [GD-DEVEL] Filling polygons with holes

[email protected] (Brian Peschel) Wed, 08 Oct 2008 13:30:30 -0500
Newsgroups php.gd.devel
Message-ID <[email protected]>
Brian Peschel wrote:
> That looks like what I want.  Assuming of course that the hole doesn't 
> have to be the background color.  I will have overlapping filled 
> polygons with holes, so the color of the 'hole' isn't necessarily the 
> background color.
>
> Is there sample code somewhere for the images?
>
> - Brian
>
> Pierre Joye wrote:
>> hi,
>>
>> On Tue, Sep 30, 2008 at 10:09 PM, Brian Peschel <[email protected]> 
>> wrote:
>>  
>>> Is there an easy way to do filled polygons with holes?  Think a 
>>> donut where
>>> I want to fill the donut, but not the hole.
>>>
>>> I suppose I could do something where I am create an png image just 
>>> of the
>>> polygon with transparent color for the hole and outside the polygon....
>>>     
>>
>> Do you mean something like that:
>>
>> http://pierre.libgd.org/polygons/
>>
>> Cheers,
>>  
I guess I should have tried it before I posted to the list.  Combining 
into a single polygon allows it to work.

Question though.  Is there a way to specify whether the fill should 
follow the nonzero winding rule or the even-odd rule?  It appears GD is 
using the even-odd rule and I would prefer the nonzero winding rule.

http://www.noodlesoft.com/blog/2006/11/30/mmmdonuts/

has some discussion and an image that shows the difference.

Thanks!
- Brian