[cairo] [RFC] cairo_stroke_to_path implementation

Jeff Muizelaar jeff at infidigm.net
Mon Feb 1 18:31:39 PST 2010

On 29/01/10 4:26 PM, Behdad Esfahbod wrote:
> On 01/29/2010 01:16 AM, Jeff Muizelaar 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.
> Thanks Jeff!  Got branch?  Also, a few lines about the algorithm maybe?
I have a branch at 
jrmuizel at people.freedesktop.org:~/git/cairo:stroke-to-path2 but it's a mess
and hasn't been merged with trunk.

The algorithm basically just traces a new path, offset a particular 
distance, around the input path. To do this we iterate over the path 
forwards and then backwards. The resulting path will have intersections, 
but can be filled with the non-zero winding rule.

To offset splines it uses the offset of the control polygon as an 
approximation of the offset spline and will recursively subdivide the 
spline until the approximation is good enough. This method will 
occasional diverge from the spline we're trying to approximate, in those 
cases we 'convolve' the control polygon with an arc approximation with 
the same starting and ending normals.


More information about the cairo mailing list