• 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: NSAffineTransform scaleBy not scaling
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSAffineTransform scaleBy not scaling


  • Subject: Re: NSAffineTransform scaleBy not scaling
  • From: Graham Cox <email@hidden>
  • Date: Sat, 5 Dec 2009 11:47:29 +1100

On 05/12/2009, at 10:59 AM, Shane wrote:

> Anyone see anything wrong that I'm doing?


Yes, you are transforming the pointsPath 'in place'. You need to make a copy of the original path, apply the transform to it and draw the copy. Making a copy every time in drawRect: should be OK unless your path is very, very complicated - the copy is always going to be much faster than the rendering so don't worry about performance.

I thought I'd mentioned the need to do that in my previous message: "You'll need to regenerate a new path for each plot though, as the path will be permanently changed by the above." I guess it wasn't clear what I meant by that.

Also, when you get to applying both the translation and the scale together, watch the order. You want the translation to be independent of the scale, so apply it after scaling. That means, counterintuitively, that you do that first to NSAffineTransform, before the scaleBy step. I find it helpful to think of the operations that NSAffineTransform does to be in reverse order of how they appear in the code. In reality it does not do things as a series of steps but all at once, but the effect is as if it had applied the series of operations, but in reverse order.

As you have it in the code now should be correct.

--Graham


_______________________________________________

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: NSAffineTransform scaleBy not scaling
      • From: Shane <email@hidden>
References: 
 >Re: NSAffineTransform scaleBy not scaling (From: Shane <email@hidden>)
 >Re: NSAffineTransform scaleBy not scaling (From: Graham Cox <email@hidden>)
 >Re: NSAffineTransform scaleBy not scaling (From: Shane <email@hidden>)

  • Prev by Date: Re: Best way to hook into the run loop?
  • Next by Date: Re: NSRuleEditor rows binding
  • Previous by thread: Re: NSAffineTransform scaleBy not scaling
  • Next by thread: Re: NSAffineTransform scaleBy not scaling
  • Index(es):
    • Date
    • Thread