[cairo] Hairlines

Ian Britten britten at caris.com
Wed Jan 28 08:00:00 PST 2009

Gustavo Carneiro wrote:

>     I'm still struggling with how to best handle hairlines, and am wondering
>     if anyone could offer some guidance/suggestions...

>     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.  

But that's what I'm lamenting - I can't get similar-to-the-user output.
[ Note I'm saying 'similar', not 'exact'.  I don't think hairlines will
ever be exact, but for users using them, they obviously don't care about
pixel-perfect output. ]

In my PDF output, the line is there and looks fine.  In my PNG output,
the line is *missing*.  I wouldn't call that consistent.  Nor will my
my users, who will simply report it as a bug ("Lines missing in output")
Obviously, I'll have to do something to prevent that...

[ NB - In case you missed it, there was some discussion about possibly
supporting these in Cairo:
    http://lists.freedesktop.org/archives/cairo/2008-August/014814.html ]

> 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.

This is a different issue, I believe.  How a particular application
downsamples and presents data on a particular monitor has nothing to do
with how the initial data file is created (Which is the case I'm trying
to address at the moment)
[ If I'm wrong though, please enlighten me!  :) ]


More information about the cairo mailing list