• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: upside down image
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >upside down image (From: email@hidden)

  • Prev by Date: upside down image
  • Next by Date: Re: same table, different delegates
  • Previous by thread: upside down image
  • Next by thread: Page margins and NSPrintInfo
  • Index(es):
    • Date
    • Thread