Re: combining NSBezierPath
Re: combining NSBezierPath
- Subject: Re: combining NSBezierPath
- From: Alastair Houghton <email@hidden>
- Date: Thu, 23 Aug 2007 14:46:35 +0100
On 23 Aug 2007, at 13:50, Alexander Cohen wrote:
I have a bunch of NSBezierPath's and i would to combine them in
order to get 1 NSBezierPath that i can fill or stroke. Is there a
way i can do this using the bezier path methods?
It depends what you want to do and on what the paths are like.
If the paths don't contain self-intersections or overlaps, and are
both oriented in the same direction, then you can append one to the
other (after a -closePath, if necessary) and then you can easily fill
the union (by setting the winding rule to NSNonZeroWindingRule and
sending a -fill message) or the symmetric difference (by setting the
winding rule to NSEvenOddWindingRule and then sending the -fill
message).
Also, if you know the device you're working on, it's easy to perform
arbitrary operations by doing them in the raster domain once you've
rendered the individual path elements.
If you're talking about complex paths and arbitrary Boolean
operations, I'm afraid that that's a very difficult problem to solve
in the general case. It's significantly harder than the same problem
for polygons (where you'll find there are a number of Open Source
libraries that can do what you need).
See <http://www.cocoadev.com/index.pl?NSBezierPathcombinatorics> for
more on this topic.
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden