[cairo] cairo anti aliasing

Bill Spitzak spitzak at d2.com
Mon Feb 28 13:22:08 PST 2005



Tim Janik wrote:

> i'm not sure i correctly get your argument about units here.
> currently, i'm using logic that attempts to preserve the feather edge
> width in pixels, regardless of zoom or other transformations applied
> to the rendered object.

If you printed this image on a high-resolution printer, the "feather 
edge" would scale down by the resolution if it is measured in pixels. If 
there was infinite resolution you would be unable to distinguish any 
possible settings of this "antialias" control. I don't believe that is 
what you want.

However, antialiasing is an attempt to simulate infinite resolution on a 
limited resoultion device. The scale does not enter into it, you should 
get exactly the same result if you draw a 10x10 square or draw a 100x100 
  square at 1/10th the scale. So when working with antialiasing 
everything is measured in pixels.

If you want a control to do both antialiasing and blurring, there has to 
be a setting that is "1 pixel". Once you set it large enough, you want 
the setting to be "N units". Merging these together is difficult.

The most logical way is to make 0 == antialias only. However a lot of 
people (like you) think zero should mean "disable antialiasing". So it 
looks like the control should somehow be set up so 0 = 0, 1 = 1 pixel, 
and N = N units as N approaches infinity. Maybe a curve would be best, 
but two linear segments may also be ok.

>> It may be better to describe the desired result directly. The rectangle
>> on the right, including the Mach banding points, can be replicated in
>> existing Cairo as a smaller white rectangle and 4 thin trapazoids drawn
>> around the edges with a gradient ramp, white on the inside touching the
>> rectangle and black on the outside.
> 
> that'd applicable only for this example. but i'm indeed more interested
> in using the gaussian integrals as an antialiasing and rendering technique.

Blurring with a gaussian will NOT anti-alias the image. You proved this 
yourself by showing that you could still see the steps by blurring a 
tilted non-antialiased rectangle. Gimp is not blurring by a gaussian, it 
is drawing point-sampled ramps on all edges of the polygon. This can 
clearly be seen from the Mach-banded "points" on the corners.




More information about the cairo mailing list