可可粉NSView被弄脏的背景 [英] Cocoa NSView blurred background
问题描述
我知道可以在Cocoa中创建透明窗口,虽然可以模糊它的后面吗?我知道有我创建了。我子类化了 NSWindow
以禁用透明度,然后我添加了一个背景过滤器:高斯模糊到 NSView
使用视图效果检查器位于Xcode Utilities侧栏(您可以更改 radius
值以获得更多或更少的模糊效果)。
如果您想要新的Yosemite View效果,请查看他们发布的新类 NSVisualEffectView ,只需要子类 NSView
即可使用此效果。
希望您认为我的答案有用。
最好的问候,
I know it's possible to create transparent windows in Cocoa, although is it possible to blur whatever is behind it? I know there's been similar questions, but they deal more blurring what is within the actual NSView, not what is behind it. Is this even possible, and If so what method would I need to look into?
Possible Impossible?
In order to answer you, yes its Possible.
If you want that effect, check out this GitHub Project I created. I subclassed NSWindow
in order to disable opacity and then I added a Background Filter:Gaussian Blur to the NSView
using the View Effects Inspector located at the Xcode Utilities Side Bar (you can change the radius
value for more or less blur effect).
If you want the new Yosemite View effect, check out the new class they released NSVisualEffectView, just subclass the NSView
you want to use this effect.
Hope you find my answer useful.
Best regards,
这篇关于可可粉NSView被弄脏的背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!