Claus Wahlers
Claus Wahlers

Reputation: 1231

Quartz/CG: Draw a filled path where each line has a different stroke?

What's the best practice for drawing a closed, filled path where each line has a different stroke?

Upvotes: 0

Views: 1101

Answers (2)

Peter Hosey
Peter Hosey

Reputation: 96333

Fill the complete path, then iterate on its elements to stroke one line segment for every lineto and closepath (see actual Quartz names here). Your applier function will need to keep track of the current point itself.

Of course, if any of the elements are curveto instead of lineto, you may be screwed, but try it anyway.

Upvotes: 2

Peter Hosey
Peter Hosey

Reputation: 96333

Incidentally, if your intent is to make marching ants (a selection marquee), there's a much simpler way: Set the line dash, then fill and stroke as normal.

Upvotes: 0

Related Questions