Re: Is there a fast NSShadow alternative?
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