[cairo] negative line widths
Bill Spitzak
spitzak at gmail.com
Wed Aug 17 13:01:54 PDT 2011
Sorry I posted this somewhere else.
I agree that the line width should use the absolute value of what is
passed. Except negative numbers cause the path to be stroked backwards
(this can be visible if the dash pattern or line caps have some
orientation).
Without this it becomes annoying to do arbitrary, including mirror,
transforms.
Also I believe this is necessary if cairo is ever fixed to keep the pen
in device coordinates. If you flip the coordinates, set the pen width to
a positive value, then flip back, it is going to be negative anyway
(well the 2x2 matrix will have negative entries) so it must be handled
anyway.
lloyd konneker wrote:
> This is about a gotcha, a situation that drove me crazy, using
> context.set_line_width().
>
> Essentially my code was:
>
> context.set_line_width(
> context.device_to_user_distance(foo.x, foo.y).x
> )
>
> but then lines were invisible in some situations. So my fix was:
>
> context.set_line_width(
> abs(context.device_to_user_distance(foo.x, foo.y).x)
> )
More information about the cairo
mailing list