Re: [GD-DEVEL] Polygon with holes
| From: | Pierre | Date: | Thu, 13 Sep 2007 07:19:31 +0000 |
| Subject: | Re: [GD-DEVEL] Polygon with holes | ||
| References: | 1 | Groups: | php.gd.devel |
| Request: | Send a blank email to php-gd-devel+get-262@lists.php.net to get a copy of this message | ||
Hi Mateusz,
On 9/13/07, Mateusz Loskot <mateusz@loskot.net> 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