[cairo] Hairlines

Gustavo Carneiro gjcarneiro at gmail.com
Wed Jan 28 06:51:53 PST 2009

2009/1/28 Ian Britten <britten at caris.com>

> Hi all,
> I'm still struggling with how to best handle hairlines, and am wondering
> if anyone could offer some guidance/suggestions...
> In my early work, I used a device thickness of 1.0/300.0 (converted to
> user) as the thickness when I needed to draw these types of lines.
> This seemed to work ok when outputting to PDF.  However, when I output
> to an image (PNG), the lines don't visually appear (Too thin?).
> OTOH, if I use a device thickness of 1.0 (converted to user) as the line
> thickness, the lines look as expected in the image output.
> Unfortunately, this is far too thick in the PDF output.  :(
> Long story short, it seems that I'm going to have to examine the type
> of surface I'm using, and use different numbers for the thickness
> accordingly.  IMHO, this seems to defeat one of the abstractions that
> Cairo touts - Namely drawing the same way to any surface type.
> Thus, I figured I'd ask, and see if there isn't a better technique.

On the other hand, if Cairo had hairlines it would defeat another of the
great abstractions: consistent results independent of resolution.  Sometimes
it is deceptive when hairlines in a low-resolution display to appear thicker
relatively to other (non-hairline) lines, while thinner (almost too thin to
see) in very high resolution displays.

That being said, I used to be more against hairlines.  Nowadays, after using
goocanvas with zooming I have been bitten by this problem as well: when  I
zoom out a lot, my lines eventually disappear.

Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cairographics.org/archives/cairo/attachments/20090128/d7816f67/attachment.html 

More information about the cairo mailing list