• 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: NSImage inside(?) NSBezierPath
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSImage inside(?) NSBezierPath


  • Subject: Re: NSImage inside(?) NSBezierPath
  • From: "Alan Smith" <email@hidden>
  • Date: Thu, 13 Sep 2007 17:59:05 -0400

Hey,

To aid in clarity I will code what has been suggested.

- (void)drawRect:(NSRect)rect
{
       NSRect bounds = [self bounds];
       NSBezierPath *path = [self bezierPathWithRoundRectInRect: bounds];

       [NSGraphicsContext saveGraphicsState];

       [[NSColor redColor] set];
       [path stroke];

       [path addClip];

       [image drawInRect: bounds fromRect: NSZeroRect fraction: 1.0
operation: NSCompositeSourceOver];

       [NSGraphicsContext restoreGraphicsState];
}

I am writing all this from memory, it has been a while since I've
needed to draw an image so the order of the draw parameters may not be
correct. Passing NSZeroRect as the "fromRect" argument tells NSImage
that you want to draw the whole image, this prevents you from call -
[NSImage size] and making your own rect that is the same size as the
image.

Peace, Alan

--
My blog: cocoalatte.info

// Things I've said -------------------------
"Maturity resides in the mind."
"Silence is the Universe's greatest gift."
"When the World realizes that personal beliefs are not something to
argue or fight over, it shall evolve."
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSImage inside(?) NSBezierPath
      • From: Uli Kusterer <email@hidden>
References: 
 >NSImage inside(?) NSBezierPath (From: "Hell's KItchen Hell's KItchen" <email@hidden>)

  • Prev by Date: Re: Parallel instances of Cocoa apps?
  • Next by Date: [MEET] CocoaHeads Silicon Valley: Objective-C 2.0 TONIGHT
  • Previous by thread: Re: NSImage inside(?) NSBezierPath
  • Next by thread: Re: NSImage inside(?) NSBezierPath
  • Index(es):
    • Date
    • Thread