Re: drawing an image in an NSRect?
Re: drawing an image in an NSRect?
- Subject: Re: drawing an image in an NSRect?
- From: Iain Wood <email@hidden>
- Date: Tue, 2 Mar 2004 01:31:05 +0000
On 1 Mar 2004, at 21:24, p3consulting wrote:
@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];
Thanks, that gave me the clue I was needing. I had to modify it slighly
to get the image in the right place ie:
[knobImage
compositeToPoint:
NSMakePoint(knobRect.origin.x,knobRect.origin.y+knobRect.size.height)
operation:NSCompositeSourceOver];
(you should cache the image...)
I was going to try creating the NSImage in an init method. Is that what
you mean?
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.