Re: NSAffineTransform scaleBy not scaling
Re: NSAffineTransform scaleBy not scaling
- Subject: Re: NSAffineTransform scaleBy not scaling
- From: Graham Cox <email@hidden>
- Date: Wed, 2 Dec 2009 15:13:59 +1100
On 02/12/2009, at 3:03 PM, Shane wrote:
> Still trying to make this work right using
> transformUsingAffineTransform. If I add in translateXBy or scaleXBy,
> my wave (pointsPath) show up all wrong, not translated or scaled, but
> if I comment them out (as is below), my wave appears just fine, it's
> just not scaled. Am I not using them correctly?
The problem is that the code you've posted is not the whole story. When you create the path, it has some coordinate system within which it is referenced. You are using <pointCount> as some sort of dimensional quality of the path, which might be fine, but without seeing how the path is created it's hard to say.
When you transform the path, you transform it from its original coordinate system into a new coordinate system - therefore the original coordinate system matters greatly. In terms of scale, you should probably use [destination bounds].width / [path bounds].width for x, and [destination bounds].height / [path bounds].height for y scale factors, as I originally suggested. That way the actual size of the source coordinates is factored in whatever it is. That then just leaves you with the translation to deal with, for positioning the scaled path where you want it.
--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