Re: [GD-DEVEL] Polygon with holes
[email protected] (Pierre)
| Newsgroups | php.gd.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Mateusz, On 9/13/07, Mateusz Loskot <[email protected]> wrote: > Hi, > > Could anyone provide me with some tricks about what's the best and > efficiently way to render filled polygon with one or more holes? > IOW, how to render a donut-like polygon that's filled with red colour > but internal ring is not filled (is displayed as transparent). It is not possible using gdImageFilledPolygon, at least not with a single call. If you don't need alpha blending or antialiasing, you can call gdImageFilledPolygon many times, once per hole, not very nice :) In a "near" future it will be possible to have polygon with holes. I implemented a version with antialiasing support using a basic oversampling algorithm. Some results can be seen here: http://pierre.libgd.org/polygons/ It is not very fast but it works well, while being already better than what we have now, it is somehow limited in comparison to vector graphics libraries like agg or cairo. I can push the code in our playground repository, if it helps. Something much more promising has been posted recently by Kiia Kallio (author): http://news.php.net/php.gd.devel/234 This new algorithm and its implementation can drastically improve GD features in this area. I would love to integrate it in GD as soon as possible. But it means to first port the implementation to C. If one of you feels motivated enough to do it, please do :-) Cheers, --Pierre