Skip to content

Instantly share code, notes, and snippets.

@tolmasky
Created October 20, 2009 18:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tolmasky/214474 to your computer and use it in GitHub Desktop.
Save tolmasky/214474 to your computer and use it in GitHub Desktop.
NSRect rect = [self bounds];
CGRect bounds = CGRectInset(*(CGRect *)&rect, SHADOW_HORIZONTAL_INSET - 0.5, SHADOW_VERTICAL_INSET - 0.5);
NSShadow * shadow = [[NSShadow alloc] init];
[shadow setShadowColor:[NSColor colorWithCalibratedWhite:0.0 alpha:0.5]];
[shadow setShadowOffset:NSMakeSize(0.0, -10.0)];
[shadow setShadowBlurRadius:100.0];
[[NSColor whiteColor] setFill];
[[NSColor colorWithCalibratedWhite:0.0 alpha:0.2] setStroke];
CGContextBeginPath(context);
CGContextAddArc(context, CGRectGetMinX(bounds) + 5.0, CGRectGetMaxY(bounds) - 5.0, 5.0, M_PI, M_PI_2, YES);
CGContextAddArc(context, CGRectGetMaxX(bounds) - 5.0, CGRectGetMaxY(bounds) - 5.0, 5.0, M_PI_2, 0, YES);
CGContextAddLineToPoint(context, CGRectGetMaxX(bounds), CGRectGetMinY(bounds));
CGContextAddLineToPoint(context, CGRectGetMinX(bounds), CGRectGetMinY(bounds));
CGContextClosePath(context);
CGContextDrawPath(context, kCGPathFillStroke);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment