• 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: dynamically change circle size held in NSBezierPath
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dynamically change circle size held in NSBezierPath


  • Subject: Re: dynamically change circle size held in NSBezierPath
  • From: Charlie Dickman <email@hidden>
  • Date: Sun, 25 Jul 2010 16:59:10 -0400

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 (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

Charlie Dickman
email@hidden



_______________________________________________

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

References: 
 >dynamically change circle size held in NSBezierPath (From: Shane <email@hidden>)

  • Prev by Date: dynamically change circle size held in NSBezierPath
  • Next by Date: Re: NSStatusItemthreading
  • Previous by thread: dynamically change circle size held in NSBezierPath
  • Next by thread: Core data images
  • Index(es):
    • Date
    • Thread