[cairo] Pixman centre pixel sampling in unantialiased mode.

Carl Worth cworth at cworth.org
Fri Feb 19 13:12:41 PST 2010

On 17 Nov 2009 08:17:53 +0100, Soeren Sandmann <sandmann at daimi.au.dk> wrote:
> A consequence of changing the rounding is that on an a1 surface, this:
>         cairo_move_to (cr, 1, 1);
>         cairo_line_to (cr, 50, 1);
>         cairo_stroke (cr);
> will now cause the 0th row of pixels to be illuminated, where before
> it would illuminate the 1st row. This is correct behavior according to
> how cairo interpretes coordinates, but it may be surprising and of
> course it breaks the test suite.

What's the rationale for "correct behavior according to how cairo
interprets coordinates"? Do we have a writeup somewhere of how cairo
breaks the tie when a sample point is coincident with a geometry edge?

> Reviews appreciated, as are comments on whether changing the rounding
> rules to be more consistent is worth changing the tests and
> potentially surprising users.

I like consistent. I don't think it's reasonable to have a graphics
library with inconsistent rules for things like this. There should be a
rule, it should be documented, and deviation from it should be
considered a bug and be fixed.

Meanwhile, I would *hope* that users are placing their geometry edges
centered between A1 sample points rather than directly on them. (But
with A1, who knows---maybe they just fiddled until they got the result
they wanted.)

I'm willing to take this change and update the test suite, (assuming
consistency with a documented rule as a I described). As for how to
reduce the potential surprise to users---that's a tough thing to
predict. Let's try it and find out, perhaps?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20100219/56416a90/attachment.pgp 

More information about the cairo mailing list