What's the best practice for drawing a closed, filled path where each line has a different stroke?
+3
A:
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.
Peter Hosey
2009-09-02 16:59:40
i'm screwed, paths contain curveto's :(
Claus Wahlers
2009-09-02 17:11:42
You may not be screwed after all, the more I think about it. You should try it.
Peter Hosey
2009-09-02 23:14:30
+1
A:
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.
Peter Hosey
2009-09-02 18:02:39
i would like to draw, for example, a red-filled rectangle with the north edge being 10px red, the east one 20px blue, the south one 1px green, and the west one 15px pink. this is just an example. lines may be curves too. (thanks for your answers btw, apprechiated)
Claus Wahlers
2009-09-02 18:10:30