Use the  transformUsingAffineTransform: to scale your path.

On Jul 25, 2010, at 4:53 PM, Shane wrote:

> When a user decides to display a scatter plot, I iterate through all
> my points and add the x,y points to an NSBezierPath as such with a
> fixed width and height.
> 
> - (void) addCoord:(double) xval yCoord:(double) yval
> {     
>       NSRect rect = NSMakeRect(xval, yval, 1, 1);
>       
>       [circlePath appendBezierPathWithOvalInRect:rect];
> }
> 
> Then drawRect: gets called which draws my scatter plot coordinates.
> The problem is that, my circles are already drawn to a certain size
> and I need to scale my circles proportionately with my screen size and
> I don't know what size this will be till drawRect: gets called (e.g.
> the user may be resizing the window).
> 
>       …
> 
>       NSBezierPath *copyPath = [circlePath copy];
>       
>       // Move to center of screen.
>       NSAffineTransform *xform = [NSAffineTransform transform];
>       [xform translateXBy:(bounds.size.width * 0.50)
>                                       yBy:(bounds.size.height * 0.50)];
>       
>       // Scale proportionately to screen size.
>       [xform scaleBy:(xFactor / 2)];
> 
>       [copyPath transformUsingAffineTransform:xform];
>       
>       [[NSColor yellowColor] setStroke];
>       
>       [copyPath stroke];
> 
> 
> Anyone have suggestions on how to dynamically change my circle size
> for the points which are all held within an NSBezierPath?
> _______________________________________________
> 
> 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/3tothe4th%40comcast.net
> 
> This email sent to 3tothe...@comcast.net

Charlie Dickman
3tothe...@comcast.net



_______________________________________________

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