• 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: Is there a fast NSShadow alternative?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is there a fast NSShadow alternative?


  • Subject: Re: Is there a fast NSShadow alternative?
  • From: Ken Tozier <email@hidden>
  • Date: Thu, 12 Jul 2007 09:36:23 -0400


On Jul 10, 2007, at 12:46 PM, Alan Smith wrote:

Using NSShadow to make such an inner glow is simple enough but in
order to get it the bezier path has to be stroked, I don't want the
path to show up, just the glow.

I'm doing something similar drawing the bezel for a custom search view and found that if you set the stroke width for a bezier to zero, the shadow still works. For example:


- (void) drawBezel
{
NSBezierPath *bez = [self bezel]; // generates the bezier path for the bezel

NSShadow *shadow = [[[NSShadow alloc] init] autorelease];

[[NSColor whiteColor] set];
[bez fill];

NSGraphicsContext *context = [NSGraphicsContext currentContext];
[context saveGraphicsState];

[shadow setShadowOffset: NSMakeSize(2, -2)];
[shadow setShadowBlurRadius: 2];
[shadow setShadowColor: [NSColor blackColor]];
[shadow set];

[[NSColor whiteColor] set];
[bez setLineWidth: 0];
[bez stroke];

[context restoreGraphicsState];
}


There is the problem if clipping the shadow to only the interior of the bezier but someone else will have to chime in for that solution...
_______________________________________________


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


References: 
 >Is there a fast NSShadow alternative? (From: "Alan Smith" <email@hidden>)

  • Prev by Date: Re: Core Data and Document Packages
  • Next by Date: Re: Changing the behavior of 'Return' in NSTableView
  • Previous by thread: Re: Is there a fast NSShadow alternative?
  • Next by thread: NSTableView selectionShouldChangeInTableView: bug?
  • Index(es):
    • Date
    • Thread