Re: Rotating an image in an NSImageView subclass
Re: Rotating an image in an NSImageView subclass
- Subject: Re: Rotating an image in an NSImageView subclass
- From: Gregg Witmer <email@hidden>
- Date: Fri, 11 Mar 2005 14:08:43 -0500
- (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];
}
For starters, move [super drawRect: rect]; to the end.
Secondly, don't call [self setNeedsDisplay: YES] from -drawRect, this
will cause a constant stream of events calling -drawRect.
Third if the drawn image does get rotated (and I'm not sure that it
will) you won't see it because you've rotated it out of the bounds of
the view's rect. See: -translateXBy: yBy.
Gregg
_______________________________________________
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