[cairo] Survey of polygon rasterization techniques

Matteo Muratori muratmat at gmail.com
Tue Jul 31 12:01:39 PDT 2007


> Could you elaborate on this "should be faster than both" ? I'm interested
> to know what kind of improvement you made.
>
> I just had a quick look at src/gui/painting/qgrayraster.c in Qt 4.3 and
> I don't see much differences from a relatively old version of the
> FreeType anti-aliasing rasterizer. Maybe some details escape me ?
>
> Also, you may find interesting that the current FreeType rasterizer 
> sources
> use a scanline-bucket scheme now, instead of QSort, to sort the cells. 
> I've
> done this because in some relatively common cases, it provided a x1.25 
> speedup
> in rendering time.

After having some tests, I've seen than AGG (and i suppose Freetype too) 
has some serious bugs with non simple polygons (intersecting edges, 
partially overlapping edges and so on). It sounds very strange to me 
that such high quality rasterizers have this kind of bug, because it's 
particularly sensible for font rendering, and in general the overall 
error results quite high in those pixels where intersections occur.

AGG author confirmed me that it's an inevitable sacrifice for the 
freedom of even/odd and non-zero fill. Is it true also for Freetype 
rasterizer?
Here's a simple example (a 10x10 picture):

p0: 1, 1
p1: 8, 1
p2: 1, 8
p3: 8, 8

And the results with AGG 2.5 (even-odd, but it's valid also for 
non-zero) are here:

http://www.amanithvg.com/pub_files/reports/intersection_test.png
http://www.amanithvg.com/pub_files/reports/intersection_test_zoomed.png

As it can be seen, the central pixel is totally white (instead of a 50% 
covered pixel).

About the Inkscape rasterizer, it seems pretty correct, except for the 
use of supersampling schema to do antialias (so the quality isn't 
comparable to analytical coverage calculation-based rasterizers).




More information about the cairo mailing list