• 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
NSCell drawing flipped ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSCell drawing flipped ?


  • Subject: NSCell drawing flipped ?
  • From: Stéphane Sudre <email@hidden>
  • Date: Tue, 15 May 2001 15:45:54 +0200

I'm in the process of coding a subclass of NSCell to draw the same thing the NSBrowser Cell draws without the leaf/not leaf arrow.

So the code is currently quite simple:

#import "SubClassOfCell.h"

#define CELL_ICON_WIDTH 16
#define CELL_ICON_HEIGHT 16

@implementation SubClassOfCell

- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
NSImage * tImage=[self image];

if (tImage!=nil)
{
[tImage drawAtPoint:NSMakePoint(cellFrame.origin.x,cellFrame.origin.y+(cellFrame.size.
height-CELL_ICON_HEIGHT)*0.5) fromRect:NSMakeRect(0,0,CELL_ICON_WIDTH,CELL_ICON_HEIGHT) operation:NSCompositeSourceOver fraction:1.0];
}

// Draw the text here once I figured what the hell is happening with the NSImage drawing
}

@end

I'm getting a funny result by doing this: the image is drawn flipped (vertically).

Yet when I'm using this same code on a Subclass of a NSView, the image is correctly drawn.

To get a non flipped rendering, I need to call:

if ([tImage isFlipped]==NO)
{
[tImage setFlipped:YES];
}

Strange, uh ?

Important information: I'm using this cell in a NSTableView containing NSTextField Cell and NSImageCell too.


  • Follow-Ups:
    • Re: NSCell drawing flipped ?
      • From: Andrew Platzer <email@hidden>
  • Prev by Date: Newbie Question: Multidimensional NSArrays, NullPointerExceptionErrors and Table drawing issues
  • Next by Date: Re: Type/Creator Codes
  • Previous by thread: Newbie Question: Multidimensional NSArrays, NullPointerExceptionErrors and Table drawing issues
  • Next by thread: Re: NSCell drawing flipped ?
  • Index(es):
    • Date
    • Thread