• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: dynamic NSPointArray allocation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dynamic NSPointArray allocation


  • Subject: Re: dynamic NSPointArray allocation
  • From: Shane <email@hidden>
  • Date: Fri, 27 Nov 2009 16:58:27 -0600

>
> The easiest way (and Objective-C-ish way) is to use a NSMutableData object with the NSPointArray as its data. Whenever you want to add points, just resize the NSMutableData object to 'sizeof (NSPoint)' * total number of points, and use '(NSPointArray) [data mutableBytes]' as a pointer to the start of the array.
>


I think I'm understanding this in part ...

// *.h
	NSMutableData *pointData;
	NSPointArray *points;

// *.m
	pointData = [[NSMutableData alloc] init];

	...

	NSPoint point = NSMakePoint([iters floatValue], [mse floatValue]);
	// not sure how to get an NSPoint into NSMutableData?

	// here I resize NSMutableData, but this will always only be
	// increasing the length by 1.
	[pointData increaseLenghtBy:sizeof(NSPoint)];

	// and here I assign the data to NSPointArray
	points = (NSPoint *) [pointData bytes];

And from here I can pass this NSPointArray around till I get to the
point where I will use this data for my NSBezierPath. Will
NSBezierPath (which takes an NSPointArray) be able to properly read
from 'points' by doing the above?

Am I even going about this correctly?
_______________________________________________

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

  • Follow-Ups:
    • Re: dynamic NSPointArray allocation
      • From: Quincey Morris <email@hidden>
References: 
 >dynamic NSPointArray allocation (From: Shane <email@hidden>)
 >Re: dynamic NSPointArray allocation (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: UIImageView Animation Question
  • Next by Date: Re: dynamic NSPointArray allocation
  • Previous by thread: Re: dynamic NSPointArray allocation
  • Next by thread: Re: dynamic NSPointArray allocation
  • Index(es):
    • Date
    • Thread