[GRASS-dev] Cairo monitor driver

Lars Ahlzen lars at ahlzen.com
Wed Oct 24 17:03:08 EDT 2007

Glynn Clements wrote:
> Lars Ahlzen wrote:
>> Lines 
>> with odd widths are disproportinally common due, among other things, to 
>> the fact that many d-modules do not offer control over the width of 
>> lines in their output (and always draw 1-unit wide lines).
> Actually, Cairo's default line width is 2.0 units:
> 	http://cairographics.org/manual/cairo-cairo-t.html#cairo-set-line-width
> All display modules will use this value until it's explicitly changed. 
> The cairo driver should either explicitly change the line width to 1
> at start-up, or interpret a line width of 0 as meaning 2 units rather
> than 1.

Good point. It makes sense to set the default line width to 1 unit, at
the very least for PNG output, to make sure it's consistent with the
behavior of other pixel-based monitors.

Btw, how *should* a call to Line_width with a 0 be interpreted? As
"smallest possible line width" or "default line width" or something else?

> There are only a handful of modules which actually change the line
> width, namely d.graph, d.path and d.vect. All three modules set the
> width using D_line_width() (which takes a double) and set it back
> using R_line_width(0).
> d.vect and d.graph set the width to a user-specified value, while
> d.path sets it to 2 for "bold" lines.

Interesting. So, in other words, the width of lines produced by, e.g.
the d.grid command, depends on the default line width.

Anyway, assuming that the default line width is 1 unit for pixel based
output (to be consistent), then the problem remains.

/ Lars

Lars Ahlzen
lars at ahlzen.com

Lars Ahlzen
lars at ahlzen.com

More information about the grass-dev mailing list