[cairo] 45 degree antialiased lines

Bill Spitzak spitzak at d2.com
Thu Dec 30 12:06:37 PST 2004

On Thursday 30 December 2004 03:15 am, Nathan Hurst wrote:
> On Tue, 19 Oct 2004, Bill Spitzak wrote:
> > Per the conference call, I calculated what 1-pixel stroked lines should
> > look like at 45 degrees. IMHO they look much better than the aliased
> > lines. Results can be viewed at:
> >
> > http://www.syntheticsw.com/~spitzak/lines.html
> On my digital LCD the second two of the second set of lines look too
> bright.  The first set all look the same brightness.  What do other people
> think?

Sorry I meant to explain that a little more clearly. I suspect the top result 
will be used by Cairo in order to match virtually all other software out 
there. I did think it would be nice to show correct brightnesses.

In the top example the pixel is assigned an 8-bit number that is 
proportionally equal to the coverage. In the bottom picture the 8-bit number 
is selected so the brightness of the sRGB standard (basically a gamma 
correction) is equal to the pixel coverage. (the bottom picture also has an 
aliased diagonal line, the dimmer one, you should ignore that).

You should be trying to match the brightness to the horizontal and vertical 
lines, which are exactly one pixel wide and thus the "correct" brightness.

On my LCD the bottom picture makes the horizontal, vertical, and two 
diagonals match. On my CRT the horizontal and vertical lines don't match, the 
horizontal is much brighter. The diagonals in the top match the vertical, 
while the diagonals in the bottom match the horizontal.

Make sure you are viewing the images at 1:1 zoom. Some kind of 
screen-magnifier will help to check this, the horizontal and vertical should 
be one pixel wide. If possible, zoom in by an integer (make sure you get 
blocky and not smoothed pixels) and it should be clear the bottom picture 
matches in brightness better. If this is not true I suspect your LCD has been 
set somehow to display straight-line gamma, but that would make any 
photographs from the web look very bright and washed out. It does appear that 
single pixels are very 

I am also wondering if the simple box filter I did is wrong. I should 
calculate a correct sync filter (sin(r*pi)/(r*pi) where r is distance from 
center of pixel to center of line). Problem with that is that it produces 
negative values so can only be correctly displayed with a gray background. 
Also should try thicker lines.

More information about the cairo mailing list