Re: dynamic NSPointArray allocation
Re: dynamic NSPointArray allocation
- Subject: Re: dynamic NSPointArray allocation
- From: Graham Cox <email@hidden>
- Date: Sat, 28 Nov 2009 10:07:37 +1100
On 28/11/2009, at 7:46 AM, Shane wrote:
> I don't know how large my NSPointArray size needs to be so I'd like to
> know how I would dynamically allocate NSPoints to populate an
> NSPointArray? I think I can do it with NSMutableArray, but
> NSBezierPath takes an NSPointArray (which is what my end result is for
> the points) and it just seems cleaner and more efficient if I can stay
> with that instead of converting between point arrays and mutable
> arrays.
Why not just accumulate the points directly into NSBezierPath? It can be thought of as an array of points in a sense. Unless there's a compelling need to have the points themselves available in addition to the bezier path, just cut out the middle man (and it's not difficult to retrieve the points from a bezier path in any case).
Use [path lineToPoint:] to append a new point, and [path moveToPoint:] for the first point.
--Graham
_______________________________________________
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