Re: upside down image
Re: upside down image
- Subject: Re: upside down image
- From: "Louis C. Sacha" <email@hidden>
- Date: Thu, 25 Dec 2003 12:17:21 -0800
Hello...
One of the two (either the tableView cells or the popUpButton cells)
is drawing the image using flipped coordinates, which inverts the y
axis.
In you NSPopUpButton subclass, you can fix the drawing using the NSImage method
- (void)setFlipped:(BOOL)flag;
So your drawing code to draw the image in your NSPopUPButton subclass
would look like:
[statusDot setFlipped:TRUE];
[statusDot drawInRect:drawingRect fromRect:imageRect
operation:NSCompositeSourceOver fraction:1.0];
[statusDot setFlipped:FALSE];
Or possibly (if the image is already flipped for some reason):
[statusDot setFlipped:FALSE];
[statusDot drawInRect:drawingRect fromRect:imageRect
operation:NSCompositeSourceOver fraction:1.0];
[statusDot setFlipped:TRUE];
Hope that helps,
Louis
PS: Merry Christmas (and happy holidays) to all on the list! ! !
I subclassed NSPopUpButton so I could have it display only the icon but
when clicked it displays the whole menu. It all works great except that
the image in the control is upside down. It's no big deal but after a
while it starts to bug you. I draw the images in an NSTableView as well
and they work fine there. relevant code is shown below.
NSRect drawingRect;
NSRect imageRect;
drawingRect.origin.x = 9;
drawingRect.origin.y = 7;
drawingRect.size.height = 12;
drawingRect.size.width = 12;
imageRect.origin.x = 0;
imageRect.origin.y = 0;
imageRect.size = [statusDot size];
[statusDot drawInRect:drawingRect fromRect:imageRect
operation:NSCompositeSourceOver fraction:1.0];
thanks for any help and happy holidays,
Chris
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.