>
> 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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to