我要复制码头堆栈的背景网格和列表模式。背景是半透明的黑色模糊效果:套用CIFilter背景过滤器时,主窗口是透明
的问题是,[CALayer的backgroundFilters]仅适用于内容在窗口中,将过滤器并不适用于其他窗口的内容。这是我的代码:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
//make window transparent
self.window.backgroundColor = [NSColor clearColor];
[self.window setOpaque:NO];
[self.window setHasShadow:NO];
[self.window setStyleMask:NSBorderlessWindowMask];
//make the content view layer hosting
CALayer *rootLayer = [CALayer layer];
[[self.window contentView] setLayer:rootLayer];
[[self.window contentView] setWantsLayer:YES];
//blur the background contents - NOT WORKING!
[rootLayer setBackgroundColor:CGColorCreateGenericGray(0.0, .716)];
CIFilter *blurFilter = [CIFilter filterWithName:@"CIGaussianBlur"];
[blurFilter setDefaults];
[rootLayer setBackgroundFilters:[NSArray arrayWithObject: blurFilter]];
}
我想不出如何实现这种效果。 (我看了显示服务,看看是否有任何有用的功能,但我看不到任何。)
任何想法?
神奇,非常感谢你! – 2010-07-21 14:07:41
FWIW,这不再显示在优胜美地工作。 :-(CGSNewCIFilterByName()返回kCGErrorNotImplemented。 – 2014-10-25 03:26:20