• 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: 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.


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

  • Prev by Date: Re: Giving a NSToolbaritem a command key...?
  • Next by Date: Re: NSSpliteView in Xcode Help UI
  • Previous by thread: Re: drawing an image in an NSRect?
  • Next by thread: Re: drawing an image in an NSRect?
  • Index(es):
    • Date
    • Thread