[cairo] Turning off antialiasing

Carl Worth cworth at cworth.org
Fri Oct 22 08:24:59 PDT 2004

On Tue, 19 Oct 2004 09:47:48 -0700, Bill Spitzak wrote:
> On Tuesday 19 October 2004 08:54 am, Carl Worth wrote:
> > On Mon, 18 Oct 2004 11:39:48 -0700, Bill Spitzak wrote:
> > > I do not think the proposed solution in the FAQ will do the job. First it
> > > does not work if you do any scaling, making it impossible to make sharp
> > > outlined rectangles at any transform other than the identity.

OK. I've started playing with a more robust solution. I'll follow-up
with a new thread.

> I believe you are right. Symmetric things, even if antialiased, need some 
> ability to center on pixels or half-pixels.

There's this aspect of centering, and there's also the fact that curves
that pass instantaneously through horizontal/vertical look much better
when aligned between pixels. There are similar considerations in getting
sharp points to look good. John Hobby has good examples of these effects
in his automatic font-hinting paper[1].

We may want to give these issues more thought at some point, but my
experiments so far have just been with rectilinear shapes and with
transformations that only scale and rotate.

> No, I want it to adjust to the nearest half-pixel directly with no offset, 
> except that integers always round right/down. So the right edge drawn at 
> width-epsilon will fill the pixel at width-1, which is the antialiased column.

Ah, clever. So round to the nearest half-pixel after adding an
infinitesimally small, positive adjustment.

> > 	  calling cairo_stroke_path, cairo_snap_path, cairo_fill
> This would work. The same call could also modify the line width, so it will 
> satisfy everything needed.

Yes, and this is the approach I'm taking now. See my next message for
more details.


[1] [Hobby93] John D. Hobby, Generating Automatically Tuned Bitmaps from
    Outlines, JACM 40(1), 1993.

More information about the cairo mailing list