Re: Seriously confused by behavior of NSAffineTransform
Re: Seriously confused by behavior of NSAffineTransform
- Subject: Re: Seriously confused by behavior of NSAffineTransform
- From: Kyle Sluder <email@hidden>
- Date: Sat, 2 Oct 2010 10:16:23 -0700
On Oct 2, 2010, at 10:05 AM, Ken Tozier <email@hidden> wrote:
>
> I decided to simplify and created a project just for exploring transforms. Long story short, I still find them extremely counter intuitive. After futzing with transforms for a few hours, I decided to try a different tack. TI ended up writing a base class (see below) for all my apps views which does exactly what I want re scaling "page" views. When I call the "setScale" method, it scales both the origin and size of a view and calls [self setFrame] which propagates "setScale" to all the subviews. How would I get the same sort of behavior using transforms?
You don't. As Matt explained, transforms are applied to the current graphics context state. Before calling -drawRect:, AppKit pushes a new graphics state on the stack, and pops it when your -drawRect: returns.
It sounds like you want to scale your bounds coordinate system instead. In fact, the entire trick to bounds coordinate systems is that AppKit applies a transform representing all the accumulated bounds coordinate system scales before it calls your -drawRect:. Hopefully this whole thing makes more sense to you now.
--Kyle Sluder_______________________________________________
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