Hello,

I'm trying to mimic the background of Time Machine's large On/Off switch (
http://zcr.me/l/n2 ) by drawing it via code. This is my code so far:

cellFrame.size.height = 27;

NSBezierPath *border = [NSBezierPath bezierPathWithRoundedRect:cellFrame
> xRadius:5.0 yRadius:5.0];

[border setLineWidth:1.0];

[[CZColor colorWithCalibratedWhite:0.246 alpha:1.000] set];

NSGradient *backGradient = [[NSGradient alloc]
> initWithStartingColor:[CZColor colorWithCalibratedWhite:0.387 alpha:1.000]
> endingColor:[CZColor colorWithCalibratedWhite:0.73 alpha:1.000]];

[backGradient drawInBezierPath:border angle:90.0];

NSShadow *innerShadow = [[NSShadow alloc] init];

[border addClip];

[innerShadow setShadowColor:[CZColor colorWithCalibratedWhite:0.0
> alpha:0.60]];

[innerShadow setShadowOffset:NSMakeSize(0.0, -0.75)];

[innerShadow setShadowBlurRadius:1.5];

[innerShadow set];

[border stroke];


Note:  CZColor is a subclass of NSColor with no modifications, only
additions. It shouldn't cause any issues.

This code produces the following:   http://zcr.me/l/n3

The result is close to Apple's Time Machine image, but not quite:  the
shadow is drawn all the way around the bezier path, and not just on the top.
Is there a way for my to limit the NSShadow so that it only draws on the top
part of the bezier path?

Thanks so much,
Carter Allen
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to