[cairo] status of dashed curve_to ?

Carl Worth cworth at cworth.org
Wed Jun 1 16:07:53 PDT 2005


On Wed, 01 Jun 2005 17:34:49 -0400, John Ellson wrote:
> I think I understand.  I'll look up the reference.
> 
> Are you saying that cairo already has an implemetation of this?

Yes. It starts in _cairo_pen_stroke_spline which approximates the
spline and then _cairo_pen_stroke_spline_half does the actual
convolution. It claims to be accepting a "spline" but if you look it's
just using an array of points.

So that function convolves a pen with a piecewise linear path and
stores (half) the result in the polygon. There's symmetry that could
exploited to get both halves done in a single pass.

The convolution has round caps in the result automatically, (by nature
of the round pen). It's actually general enough to accept any convex
pen already (if cairo supported such a thing), and I think I know what
it would take to support concave pens as well.

> Why not split the polyline into a list of polylines corresponding to 
> each penned dash, *before* adding the pen width?

Yeah, that should work just fine. So you should be able to get a first
cut working by just dropping that into _cairo_pen_stroke_spline.

There will still be more work to get the dashes all capped off right
and such, but we can look into that with some of the other changes
I've been mentioning lately, (like eliminating the incremental
trapezoid generation).

Oh, and we've got other assorted problems in this space, (such as caps
only being applied to the first sub-path in a complex path). This will
give me some nice motivation to fix all of this stuff.

> Then merge all overlapping polygons and fill them.

Yes, the entire stroked path, (all dashes caps, etc.), should all just
be in one cairo_polygon_t, (which allows complex polygons), and we've
got the fill code that will tessellate that nicely.

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050601/4f8cc95d/attachment.pgp


More information about the cairo mailing list