• 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
Re: drawing an image in an NSRect?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • Re: drawing an image in an NSRect?
      • From: Iain Wood <email@hidden>
References: 
 >drawing an image in an NSRect? (From: Iain Wood <email@hidden>)

  • Prev by Date: Re: Is there a bug in #include operation?
  • Next by Date: Re: Is there a bug in #include operation?
  • Previous by thread: drawing an image in an NSRect?
  • Next by thread: Re: drawing an image in an NSRect?
  • Index(es):
    • Date
    • Thread