Re: [GD-DEVEL] An algorithm for rendering antialiased polygons

[email protected] (Pierre)
Newsgroups php.gd.devel
Message-ID <[email protected]>
Hi Kiia!

On 7/30/07, Kiia Kallio <[email protected]> wrote:

> GD doesn't really support antialiased rendering properly, for instance polygons are rendered by rendering an antialiased stroke over the outline. You might want to incorporate a proper algorithm for rendering antialiased polygons. This was published in TPCG07 conference in June. See mlab.uiah.fi/~kkallio/antialiasing/ for the paper, presentation and full source code (BSD license).

Thanks a lot for the notice, a really good paper and implementation!

> A robust polygon algorithm is the cornerstone of antialiased 2D rendering: by subdividing to small edge segments it's for instance possible to render any curved shape. Also wide antialiased lines and polylines can be rendered by extruding the line to a polygon.

I fully agree, I made similar experiments using the edges
supersampling (2-32x), some results are visible here:

http://pierre.libgd.org/polygons/

I did not commit the code yet as I like to clean it up before (I
focused on the results more than on the code readability :). However,
I really like your implementation. I think it makes sense to use it
instead of mine. The license being BSD, I don't see any problem to
merge it into libgd.

I have a couple of questions (warning: I did not try intensively yet):

- does it support polygon with holes? Like the first two examples in
my link (it is a simple rectangle, but it works with custom polygon as
well)

- does it depend on agg for the rendering or do you use agg only for the demo?

- Are you interested to port it to C and/or to gd?

As shown in your demo and in my 3rd example, the gd arc and ellipse
functions (as well as the curves functions) can and will use it
(except for filled ellipse or circle, it may be much faster to use
another implementation).

Cheers,
--Pierre
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.