[cairo] [RFC] cairo_stroke_to_path implementation

Andrea Canciani ranma42 at gmail.com
Mon Feb 1 04:33:48 PST 2010


On Fri, Jan 29, 2010 at 7:16 AM, Jeff Muizelaar <jeff at infidigm.net> wrote:
> Here's my current stroke-to-path work. Algorithmically it's basically where
> I want it to be, however it's still a bit messy, especially
> cairo-stroke-to-path.c. I welcome any comments about what needs to be done,
> stylistically and otherwise, before we can add commit this.
I put it on a branch on git
(http://cgit.freedesktop.org/~ranma42/cairo/?h=wip/stroke-to-path) to
make it easier to read it.
I think it would be quite interesting to check the stroke-to-path
behaviour by using it to "emulate" stroking on the test suite as it
would be used on many degenerate cases and a few complex ones. If
nobody has tried this yet, I'll do it asap and post the results.
I started reading the code (mainly comments) and I noticed that you
chose to flatten before doing stroke-to-path for dashed styles as no
easy way to split the bezier curve at a given length came to you. On
Graphics Gems V you can find a chpter about "The Length of Bezier
Curves". It allows to get upper and lower bounds for a bezier curve,
thus could be combined with bisection to find the value of the
parameter t at which the curve should be split (when t is known,
splitting the curve is just a straightforward application of de
casteljau).
Moreover you missed quite a lot of opportunities to use some of the
functions you defined (in particular you often explicitly compute the
length of a vector_t and then normalize).
As I'll go on to reading the code I'll try to remove some of this code
duplication.
Thank you for your great job (and for the very interesting references!)
Andrea Canciani


More information about the cairo mailing list