[cairo] Drawing diagonal lines with antialiasing off

Bill Spitzak spitzak at d2.com
Wed Sep 28 11:52:10 PDT 2005

Gustavo J. A. M. Carneiro wrote:

>   Agreed.  This width-0 special behaviour induces developers to make
> shortcuts that prove disastrous later on.  For example, a developer
> might use width-0 lines in some places because they look great on his
> 1024x768 screen.  But then you run the application on a 1600x1200
> display and it looks too thin.

No, they will look correct on the different resolution. The "0 width" 
lines I am proposing will hide antialiased edges of orthogonal 
rectangles. Thus if the scale is an unexpected amount you will still get 
sharp lines and they will draw directly over any antialiased rectangle 
edges that you did not expect. Your proposal of a line width of 1 and .5 
offset will draw fuzzy lines of more than 1 pixel if the transformation 
is an unexepected amount.

> Or on a 600dpi printer it looks even
> worse.

PostScript solved this long ago. A zero linewidth draws a "hairline" 
which is thick enough to produce a visible image. On a 600 dpi printer 
it is actually several pixels thick.

> And in a vector drawing program if you zoom it (apply scale
> matrix transformation), the zero-width line stays with the same width,
> which is not what you normally want.

Actually I think that behaivor is *VERY* desirable! Programs use this 
all the time for guidelines that are not part of the final diagram.

More information about the cairo mailing list