Rotating an image in an NSImageView subclass
Rotating an image in an NSImageView subclass
- Subject: Rotating an image in an NSImageView subclass
- From: Chris Garaffa <email@hidden>
- Date: Fri, 11 Mar 2005 12:53:34 -0500
Title: Rotating an image in an NSImageView subclass
I’m trying to rotate the image in an NSImageView and running into trouble. So far, I’ve subclassed NSImageView and implemented the following:
@implementation TLRotatingImageView
- (void) drawRect: (NSRect) rect
{
[super drawRect: rect];
[[NSGraphicsContext currentContext] saveGraphicsState];
NSAffineTransform *transform = [NSAffineTransform transform];
[transform rotateByDegrees: 180.0];
[transform concat];
[[NSGraphicsContext currentContext] restoreGraphicsState];
[self setNeedsDisplay: YES];
}
Based on the second example at <http://www.cocoadev.com/index.pl?RotateAndTranslateADrawing>.
The image is displayed, but not rotated. From my understanding of the NSAffineTransform documentation, concat should do this for me. What am I doing wrong?
Thanks
Chris Garaffa
Technician
TracyLocke
P 203.857.7506
F 203.762.2229
tracylocke.com
_______________________________________________
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