[cairo] Avoiding seams

Bill Spitzak spitzak at d2.com
Thu Dec 15 12:47:25 PST 2005


Eric Hughes wrote:

 > The linearity required is not in the compositing model (exemplified by
 > the operators) but also in the anti-aliasing algorithm itself.  The
 > requirement for anti-aliasing is another form of linearity...

I don't think this has anything to do with the problem.

The problem is that when a shape partially covers the pixel, the only 
information remembered is how much of the pixel it covered. When a 
second shape also partially covers the pixel, it does not know whether 
the two shapes just touch and cover the entire pixel, or they exactly 
overlay each other and thus cover no more of the pixel, or they are 
somewhere inbetween.

There is also the second problem in that after the first shape is drawn, 
the recorded color is a combination of that shape's color and the 
background color, and there is no way to extract these two numbers again 
even if the coverage value is known.

Cairo (and every other system I have seen) does a compromise guess, 
which is that the new shape's edge is perpendicular to the previous one. 
This allows simple math, and is the only assumption whose color can be 
calculated from the already-composited color.

Cairo provides SATURATE, and XRender has "non-coincident over" that may 
be what you are thinking of as a linear compositing operator. This tries 
to assumme the two shapes fill the pixel. However it can only produce 
the correct color for this assumption if the original background was 
black. The Cairo SATURATE also tries to do this.



More information about the cairo mailing list