Created
July 30, 2014 14:32
-
-
Save peterstuart/8ec6008636bbd3f37998 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)drawRect:(NSRect)dirtyRect { | |
CGFloat blurRadius = self.blurRadius; | |
NSSize shadowOffset = NSMakeSize(0, -self.blurOffset); | |
NSImage *circularImage = [self.image maskedCircularImageWithDiameter:self.circleDiameter]; | |
NSRect rect = NSMakeRect(blurRadius, blurRadius + self.blurOffset, circularImage.size.width, circularImage.size.height); | |
NSShadow *shadow = [NSShadow new]; | |
shadow.shadowBlurRadius = blurRadius; | |
shadow.shadowOffset = shadowOffset; | |
shadow.shadowColor = [NSColor blackColor]; | |
[shadow set]; | |
[circularImage drawInRect:rect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment