drawing an image in an NSRect?
drawing an image in an NSRect?
- Subject: drawing an image in an NSRect?
- From: Iain Wood <email@hidden>
- Date: Mon, 1 Mar 2004 20:50:17 +0000
Hi,
I'm trying to override the NSSlidercell -drawKnob: method in a subclass
of NSSlider
I can get this to work with bezierpath commands, but not using an image
file. From reading the documentation and various examples collected
from apple and elsewhere this is what I think I should be doing:
@implementation DarkSliderCell
-(void)drawKnob:(NSRect)knobRect
{
//[[NSColor blueColor] set];
//[NSBezierPath fillRect:knobRect];
knobImage=[[NSImage alloc]
initWithContentsOfFile:@"/Users/ndiw/prog/Nova/darkKnob.jpg"];
[knobImage setSize:knobRect.size];
[knobImage compositeToPoint:NSZeroPoint
operation:NSCompositeSourceOver];
}
@end
However this doesn't draw anything in knobRect. (The first 2 lines did
work before I commented them out)
Is there something obvious I am missing about outputing NSImages?
Ta
Iain
_______________________________________________
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.