Re: drawing an image in an NSRect?
Re: drawing an image in an NSRect?
- Subject: Re: drawing an image in an NSRect?
- From: p3consulting <email@hidden>
- Date: Mon, 1 Mar 2004 22:24:08 +0100
On 1 mars 2004, at 21:50, Iain Wood wrote:
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];
Have you tried
[knobImage compositeToPoint: knobRect.origin
operation:NSCompositeSourceOver];
?
(you should cache the image...)
Pascal Pochet
email@hidden
_______________________________________________
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.