[cairo] Re: Avoiding seams

Bill Spitzak spitzak at d2.com
Mon Dec 12 16:56:12 PST 2005



mental at rydia.net wrote:
> Quoting mental at rydia.net:
> 
> 
>>I've got a nasty feeling that OSS renderers have been pursuing a
>>dead end in this regard.  It's a 90% solution that doesn't seem
>>to admit a 10% fix.
> 
> 
> However, it may well be that there is no good solution if you want
> to avoid FSAA.  We may have to wait for high-resolution devices to
> become commonplace to escape the "incremental rasterization" versus
> "seaming/aliasing" tradeoff.

I'm fairly convinced this is true as well. As pointed out by the 
original poster, my "aliased lineto" won't help if you are coloring the 
polygons differently. FSAA by oversampling looks like the only way to go.

> In that case, I think it falls to cairo to make
> FSAA-via-oversampling (at least) easy.

On upcoming hardware, the best way would be for a window to have an 
oversize offscreen buffer that is permanently allocated. Windowing 
systems may scale this down to the displayed version in the compositing 
step. I think Cairo will have to create or modify this buffer when FSAA 
is requested to make the interface easy.

As I see it, there should simply be cairo calls to turn FSAA on or off. 
These have the side effect of flusing the graphics to the screen, to 
make it possible to copy from one buffer to another. These may otherwise 
be no-ops (because the device is either always in FSAA mode, or it does 
not implement it, or because it can only turn it on, not off).

> For that, you don't really
> want to turn off all antialiasing (e.g. you still want to filter
> bitmaps), you just want to disable approximation of partial pixel
> coverage for tesselated geometry.

In fact you may not want to disable antialiasing for anything except fill:

Even strokes of lines could be antialiased in the oversampled buffer, as 
this will allow representation of very thin lines and many more 
effective line thicknesses, and fix problems with lines changing 
apparent thickness as they are rotated. It would break anybody who 
attempts to fill a region with adjacent lines, but I'm doubtful this is 
really required.

Leaving the font antialiasing on would also help, as again it could 
result in finer effective gradations in font size, and better small 
fonts. Letter outlines should be hinted to the final resolution

And certainly all images should continue to be filtered when resampled 
(I think this should be true even if the caller turns off antialiasing). 
Any code using a source image should treat the edges as though the edge 
pixels fill out to infinity when filtering. If the user requests black 
outside, a better result is to correctly calculate the transformed 
rectangle and clip to that.


More information about the cairo mailing list