[cairo] Problems with cairo_get_line_width and "new" semantics
cworth at cworth.org
Fri May 19 03:42:13 PDT 2006
On Tue, 16 May 2006 14:42:08 -0700, Bill Spitzak wrote:
> Better proposal for dashes to make pens only be a matrix:
Thanks for bringing up dashes since I hadn't tested this.
The dash-allotment code was previously parceling out dashes by
transforming device-space segments to user space (at the time of the
stroke) computing the next dash length in that space, and then
transforming that back to device space.
So when I made the changes for the line-width-scale branch I changed
this to use the pen matrix rather than the CTM.
But know you've got me thinking about whether that's the right matrix
I checked the documentation for cairo_set_dash and what we say there
is that the numbers represent user-space lengths. So, in 1.0 this was
user space at the time of the call to cairo_stroke. In my
line-width-scale branch it is user space at the time of a call to
cairo_set_line_width (and something else in the case of cairo_set_pen
though I won't bother with that one since I think it does not have the
semantics that have been discussed most recently).
So the trend lately has been to make graphics-state operations lock
the CTM at the time of the operation. So we could do dash dispensing
in the user space that was active at the time of cairo_set_dash.
It turns out the patch to do this was pretty easy. I did it on top of
my current line-width-scale branch and the patch can be seen here:
That adds a test case demonstrating the ability to independently
transform the path, the pen, and the dash allotment, which seems like
rather pleasant flexibility. The results of the image backend can be
However, none of the current PS, PDF, and SVG backends can handle this
test case. In every case where the dashing and the pen are transformed
differently, the dashing is alloted as if subject to the pen's
So we're definitely straying beyond the capabilities of those models
with this. But we could also easily detect when the dash_matrix and
the pen_matrix do not match and do this manually. We could do
image-based fallbacks right away, or even nasty filled, tessellated
trapezoids. Down the road, the proper fallback for this would be a
single filled path for all the dashed elements of the stroke.
So, what do people think? Is it worth throwing in this extra
capability? Or am I going to far? Does anyone even care about
transformed dashing at this level of detail?
> cairo_set_dashscale(,n) stores this number, and multiplies the current
> dash pattern by the ratio between this and the previous one (? if this
> is what back-compatability requires).
PS. I couldn't mask sense of what dashscale would do, nor why it would
be needed exactly.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060519/c2e76008/attachment-0001.pgp
More information about the cairo