Re: Seriously confused by behavior of NSAffineTransform
Re: Seriously confused by behavior of NSAffineTransform
- Subject: Re: Seriously confused by behavior of NSAffineTransform
- From: Matt Neuburg <email@hidden>
- Date: Sat, 02 Oct 2010 06:22:35 -0700
- Thread-topic: Seriously confused by behavior of NSAffineTransform
On Sat, 2 Oct 2010 03:50:58 -0400, Ken Tozier <email@hidden> said:
>I'm trying to learn to use NSAffineTransforms and am finding their behavior so
bizarre that they are all but useless.
Transforms aren't at all useless, so it might be better to make a different
assumption. Have you looked at the many code examples showing its use?
>Basically, I have a view into which I place a bunch of "page" subviews. The
goal is to be able to resize the pages much like iPhoto does with thumbnails, by
treating each page as a single object and scaling that. The docs state "Scaling
does not change the origin of the coordinate system" but that definitely is not
what I'm seeing. As soon as I resize the view by so much as a single pixel, all
the page views vanish. So my questions are:
>
>1. If I apply a scaling transform to a page view containing stuff like text,
photos, etc..., should the transform treat the page view as a single unit?
Currently, I'm having to apply the transform not only to the page, but to each
item it contains. In other words, the content does not scale with the view that
contains it.
Perhaps it might be useful if you were to show some code? At least show
where you're using a transform and what transform you're using. What does
"apply a scaling transform to a page view" mean?
A transform is just a way of affecting subsequent drawing in a graphics
context (in particular, the current context). It's useful, for example, in
an NSView's drawRect: implementation to let the coordinate system do the
calculation for you so you don't have to do it. Drawing a rotated rectangle
would involve all sorts of nasty trig, so instead you rotate the coordinate
system and draw a normal rectangle, etc.
That doesn't seem to have much to do with what you're saying so it's a bit
hard to envision what you're actually doing and why. m.
PS A transform can also be applied to a CALayer as a way of affecting how
*it* is drawn; for example you can scale up a layer. This sounds like it
might be more like what you're talking about, except that then you'd be
saying CGAffineTransform, not NSAffineTransform.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.apeth.net/matt/default.html#applescriptthings
_______________________________________________
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