-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Have way to specifying subpaths #7
Comments
My main concern in forcing to split everything in multiple paths is that something like this becomes suddenly more tedious:
Now, you have to split it in 2 separate layers:
Separating into multiple layers should only be done if it helps 'seeing' the final image IMO. I propose that separate paths be defined by skipping 2 characters, while skipping 1 character only create subpaths. It would break existing ASCII art, but that's fine, there is only one app shipping some. |
Fair enough though I would argue in for that particular icon, you want a composite path as the X should be clear and not painted white. |
Yes, and that's another issue I have faced: using [NSColor clearColor] indeed does not work when drawing all the shape in the same context (same for the lock example). It's another thing that would be nice: allow compositing of the bezier paths instead of just layering. Your approach would allow to do it in code, but wouldn't it be nice to have some kind of |
Well, again, I think a compound path is the solution here. In your example, you draw the circle, then you draw the outline of the X. Depending on winding rule, you may have to make sure to draw the X in the opposite direction of the circle. That allows you to draw shapes with holes instead of having to draw shapes on top of eachother to simulate holes. I know I seem to be pimping my blog but relevant article: http://www.noodlesoft.com/blog/2006/11/30/mmmdonuts/ The lock example is a bit trickier since you'd need a way to draw a semicircle. I thought about adding support for drawing arcs though the syntax for it can get messy since there's a bit more data you have to specify. |
Ah, very nice, thanks for pointing that out! That's indeed one more strong argument for coumpound paths. In this particular case,the X is not a closed path, though: just 2 lines. Not sure it could be done quite the same way. I also could not find a method to convert a stroke into a closed path (stroke outline). I had considered arcs as well, but indeed not sure how to do it right. One way for indivual arcs would be to pass that as a parameter in the context, but that does not help in connecting an arc to another path (well, I suppose the order of the character sequence could be taken into account in that case...). |
Ah, got it: CGContextReplacePathWithStrokedPath() |
Paths need not be contiguous and having composite paths are necessary to have shapes with holes in them. Personally, I think all paths in one ASCII representation should be part of one path and you would use multiple paths/representations for separate shapes. But if you want to work it all into a single rep then that's your choice.
The text was updated successfully, but these errors were encountered: