Created
April 28, 2015 10:35
-
-
Save joerick/d52f188b926835b1f655 to your computer and use it in GitHub Desktop.
-[NSWindow _cornerMask] implementation for hosting NSVisualEffectView
This file contains hidden or 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
- (NSImage *)_cornerMask | |
{ | |
CGFloat radius = 4.0; | |
CGFloat dimension = 2 * radius + 1; | |
NSSize size = NSMakeSize(dimension, dimension); | |
NSImage *image = [NSImage imageWithSize:size flipped:NO drawingHandler:^BOOL(NSRect dstRect) { | |
NSBezierPath *bezierPath = [NSBezierPath bezierPathWithRoundedRect:dstRect xRadius:radius yRadius:radius]; | |
[[NSColor blackColor] set]; | |
[bezierPath fill]; | |
return YES; | |
}]; | |
image.capInsets = NSEdgeInsetsMake(radius, radius, radius, radius); | |
image.resizingMode = NSImageResizingModeStretch; | |
return image; | |
} | |
- (NSImage *)cornerMask | |
{ | |
return [self _cornerMask]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment