NSCell drawing flipped ?
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.