Re: How to affinely transform an NSView's content
Re: How to affinely transform an NSView's content
- Subject: Re: How to affinely transform an NSView's content
- From: "John C. Randolph" <email@hidden>
- Date: Sun, 6 May 2007 07:15:01 -0700
On Apr 20, 2007, at 5:50 AM, Ewan Delanoy wrote:
Hello all,
I have trouble connecting the different parts of the documentation
that deal with drawing rotated/translated/resized images. I think
NSAffineTransform
is the tool I need. The "Cocoa Drawing Guide: Using Transforms in
Your Code" section provides code snippets, but
1) It is not clear in which method those snippets must be put
( drawRect: , initWithFrame: ?)
2) Some snippets contain the metaphorical instruction
[item draw];
When "item" is the contents of a rect in an NSView, I don't
see what real-life instruction should replace it.
My aim is the following : To create a subclass RotatedView
of NSView that has a constructor method
-(id) initWithView: (NSView*) originalView
It is intended that the contents of subrectangle "rect1" of
"originalView"
should be re-drawed in the RotatedView instance,
with a rotation of alpha degrees and compression factors cWidth,
cHeight, starting from point newOrigin. The RotatedView instance is
used later for printing.
NSAffineTransform is overkill for what you're describing. See
NSView's -setBoundsRotation: method.
-jcr
"This is not a book to be tossed aside lightly. Rather, it should be
hurled with great force." -Dorothy Parker
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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