[cairo] Options for disabling antialiasing (was: Re: Cairo developers conference call...)

Carl Worth cworth at cworth.org
Fri Oct 15 11:34:59 PDT 2004

On Fri, 15 Oct 2004 10:22:17 -0700, Bill Spitzak wrote:
> On Friday 15 October 2004 08:46 am, Ravindra wrote:
> > 1. Antialiasing
> >
> > WHY: We don't want antialiasing always on. We would like to set it
> > on/off as required. If you see our SWF output, you would know why do we
> > need this.

Do you have an example of this SWF output I can look at? And could you
explain what it is that you want to be different?

When talking about a desire to "turn off antialiasing" I think it's
important to determine what's really wanted, and see what we can do to
achieve that. The architecture of cairo does not lend itself to skipping
the do_antialiasing() function call or anything like that. But cairo is
intended to let you draw what you'd like to draw. So, help us understand
what it is you are trying to do.

> Although I agree that something is needed, I feel that the only thing wanted 
> is non-anti-aliased horizontal and vertical 1-pixel thick lines. I do not 
> like the idea of turning antialising on/off.

Yes, getting blurry horizontal/vertical lines might be one reason a user
would say, "I wish I could turn off antialiasing". But this affects more
than 1-pixel thick lines. It can happen at any width, (though as the
width gets larger and the pixels get smaller, the effect is less
noticeable of course as it only affects the edges). In particular, any
amount of scaling can trigger problems like this.

> My preference is to have the line width control, when set to zero, to 
> completely alter the "stroke" mechanism so that line ends are rounded to the 
> nearest center of a pixel [...]

I definitely don't want to go down the magic-behavior-with-zero-width
path. If a zero-width line is defined as having a width of 1
device-pixel, then all these lines disappear on high-resolution devices.
And more significantly, if we provide sharper-looking results for
zero-width lines, then there going to get used to the exclusion of the
actual width that the user might prefer.

Instead, I'd like to see a more general approach for getting automatic
snapping to device-pixel boundaries regardless of the line width and the
nature of the CTM. For a long time, I had thought that the snapping
should belong in layers above cairo, but I'm now leaning toward putting
directly into cairo. This would of course be controlled by some switch
in the graphics state so it wouldn't interfere when when not desired,
(eg. when trying to do animation involving sub-pixel position, such as a
smooth zoom).

Keith has been playing with automatic snapping in his twin code with
good results.


More information about the cairo mailing list