[cairo] Incorrect rendering of the edges of overlapping polygons
dbenbenn at gmail.com
Sun Dec 4 16:14:13 PST 2005
Librsvg doesn't handle antialiasing at the edges of overlapping
polygons correctly. I wrote to them , and they say the problem is
Consider the following SVG code fragment:
<polygon points="0,0 0,1 1,0" fill="red" />
<polygon points="0,0 0,1 1,0" fill="white" />
This draws a right triangle, fills it with red, then fills the same
triangle with white. If you ask Rsvg to render this code to a 1x1
image, you get a pink pixel (instead of white).
It seems that Cairo is using a naive / simplified algorithm for
determing the color of edge pixels. In particular, for the example
above, it seems to say to itself:
1) First, make the pixel half-red, since the first triangle takes up
half the pixel's area.
2) Second, add half-white to the pixel, making it one-quarter-red,
since the second triangle takes up half the pixel's area.
Is this a known bug? Is there interest in fixing it? I think that a
fix would be fairly complicated, since you'd have to figure out the
detailed geometry inside each pixel to determine what color each pixel
should be. I'm willing to help write code.
More information about the cairo