Re: NSAffineTransform question
Re: NSAffineTransform question
- Subject: Re: NSAffineTransform question
- From: "Janek Priimann" <email@hidden>
- Date: Wed, 25 Apr 2007 14:18:06 +0300
Right now the image is rotated around (0,0). To fix this problem:
float deltaX = imageRect.size.width * 0.5;
float deltaY = imageRect.size.height * 0.5;
[xform translateXBy:deltaX yBy:deltaY];
[xform rotateByDegrees:90];
[xform translateXBy:-deltaX yBy:-deltaY];
On 4/25/07, Ewan Delanoy <email@hidden> wrote:
Hello all,
I'm using NSAffineTransform to draw a rotated image in
a view. When I delete the NSAffineTransform part
in my code, I get the results i expect, but when I add the NSAffineTransform
instructions I see nothing at all in the view.
The relevant snippet (in the drawRect: method) goes :
/*version 1 : without the NSAffineTransform stuff */
[theImage drawInRect:drawingRect
fromRect:imageRect
operation:NSCompositeSourceOver
fraction:1.0];
/*version 2 */
NSAffineTransform* xform=[NSAffineTransform
transform];
[xform rotateByDegrees:90];
[xform concat];
[theImage drawInRect:drawingRect
fromRect:imageRect
operation:NSCompositeSourceOver
fraction:1.0];
[xform invert];
[xform concat];
Apart from that region, my code is identical
in the two cases. Did I put the instructions in the wrong order ?
Ewan
_______________________________________________
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
_______________________________________________
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