dynamically change circle size held in NSBezierPath
dynamically change circle size held in NSBezierPath
- Subject: dynamically change circle size held in NSBezierPath
- From: Shane <email@hidden>
- Date: Sun, 25 Jul 2010 15:53:30 -0500
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 (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