Re: NSImage Rotation
Re: NSImage Rotation
- Subject: Re: NSImage Rotation
- From: Shawn Erickson <email@hidden>
- Date: Tue, 29 Mar 2005 08:15:55 -0800
On Mar 29, 2005, at 8:05 AM, Ian was here wrote:
45 degree angles cause the image to only show part
way, while 180 degrees causes the image to disappear.
Not knowing how you are doing your rotation....
It sounds like you are rotating the image without translating it.
Basically a rotation transform will rotate things about the origin (the
lower left corner) unless you translate things as needed to make it
rotate about the center of your image (or whatever you are attempting
to rotate).
Something like this...
// need only if things after shouldn't be xlated
[NSGraphicsContext saveGraphicsState];
[rotation rotateByDegrees:angle];
[translation translateXBy: NSMaxX(bounds)/2 yBy: NSMaxY(bounds)/2];
[translation concat];
[rotation concat];
// draw your image
// need only if things after shouldn't be xlated
[currentContext restoreGraphicsState];
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden