[cairo] line width = 0.0 ?

Christian Krause krause.chr at gmail.com
Sat Jan 7 12:05:36 PST 2006


Hi Keith,

Thank you very much for your detailed explanation.

Only some easy questions left: ;-)

On 1/7/06, Keith Packard <keithp at keithp.com> 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?

No, I haven't. I just wondered how lines with a width of 0.0 should be
drawn. So far no problem with cairo. ;-)

> > 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"?
>
> There is no limit to the width of a renderable line in cairo; any
> non-zero width can have a visible effect on the screen.

Ok.

> If you're asking for the 'postscript' definition of zero width lines,

Yes, the line width specification of pdf and of postscript are
similiar. Both says that zero-width lines should be drawn as small as
possible (so that they are still visible).

> I'll note that many implementations don't actually draw one pixel width
> lines on high resolution devices. Instead, the effective definition of a
> postscript zero width line is a line whose width is about 1/300 of an
> inch...

Just a dumb question: Can I just use set this length with
cairo_set_line_width(cairo, 1.0/300)
?

I've not found it in the cairo API manual, but is it right that all
kind of length values are in inches (and how many pixel are drawn
depends on the dpi setting)?
If there is a tutorial and any other documentation which explains
these basics, please can you tell me where I can find it?

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

Using 1.0/300 is line width seems to be too small for this purpose.
Even with 300% zoom factor in evince the pdf "zero width line" is not
visible.

Best regards,
Christian


More information about the cairo mailing list