Question about NSImage and setFlipped
Question about NSImage and setFlipped
- Subject: Question about NSImage and setFlipped
- From: Joe Chan <email@hidden>
- Date: Fri, 26 Nov 2004 16:06:01 -0500
I have a NSImage that I'd like to draw with NSImageInterpolationHigh
into a flipped view. So I have the following code in drawRect:
- (void)drawRect: (NSRect)rect
{
NSImageRep *rep = [_image bestRepresentationForDevice: nil];
NSRect imgRect = {0, 0};
imgSize.size = [_image size];
NSImage *copy = [[NSImage alloc] initWithSize: imgRect.size];
[copy lockFocus];
[[NSGraphicsContext currentContext] setImageInterpolation:
_imageInterpolation];
[rep drawInRect: imgRect];
[copy unlockFocus];
[copy setFlipped: [self isFlipped]];
[copy drawInRect: [self bounds] fromRect:
operation: NSCompositeSourceOver fraction: 1.0];
[copy release];
}
Which resulted in the image being drawn upside down. However, if I
setFlipped before [copy lockFocus], it'll work properly. Reading the
docs seems to imply that NSImage only uses the value passed into
setFlipped for drawing into a view. Why must I setFlipped before
drawing into the new NSImage for it to be drawn correctly?
-----------
Joe Chan
email@hidden
http://www.firstian.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