[cairo] line width = 0.0 ?

Bill Spitzak spitzak at d2.com
Mon Jan 9 12:53:47 PST 2006


Keith Packard wrote:
> On Sat, 2006-01-07 at 19:01 +0100, Christian Krause wrote:
> 
> 
>>1. What is the meaning of a line width = 0.0? Should the line be visible?
> 
> It doesn't draw anything. Because cairo can usefully draw sub
> pixel-width lines, and because it has an affine transform that affects
> the visible line width, it really can't do anything different; you'd
> have lines 'underflow' to 0.0 line width and suddenly become visible
> again?

As defined by Cairo, 0.0 is invisible.

However underflow is *not* a problem or excuse for this. It would be 
trivial to remember whether the number passed in was non-zero, no matter 
what happens to the transform. In fact I expect an internal "line width 
is zero" switch would be the actual implementation. The main reason for 
using 0.0 linewidth to trigger it is that it avoids adding another call 
to Cairo, and for compatability with every other graphics API I have 
ever seen.

>>2. How can the following achieved in cairo (as e.g. required in the
>>pdf specification):
>>"Draw the thinnest line which can be rendered in the current context"?
>
> So, if you're interested in drawing Postscript '0 width' lines, you
> might consider just using 1/300th of an inch as the nominal width. These
> will still be faintly visible on the X screen at 1-1 resolution, and
> when zoomed will appear with a reasonable relative width.

No this is not what is wanted. The resulting lines should be the same no 
matter what the current transformation is. If you scaled by .5, these 
72/300 lines would draw 1/2 as bright. We need lines that draw exactly 
the same (and are thus visible) no matter what the transform is.


More information about the cairo mailing list