10

In one of the WWDC 2014 talks on the new Yosemite UI, it says to avoid the use of NSVisualEffectView in masked layers. Unfortunately my view's layer does have a shape mask, and as a result the visual effect view in it has an ugly jagged edge effect:

gross

However I know it must be somehow possible to create a masked visual effect view, partly due to 2 reasons:

  • The image mask property on NSVisualEffectView produces a smooth, anti-alised mask (but requires an unmasked background behind it, and not just an unmasked parent view)
  • NSPopover and NSMenu seem to be able to achieve a smooth mask that changes with dimensions:

Smooth

Also smooth

Although it is doubtable as to wether or not they use NSVisualEffectView, and not a custom blurred view.

Is there any way I can achieve this smooth mask that doesn't rely on a mask image but rather a path or shape layer?

Luke
  • 4,908
  • 1
  • 37
  • 59
  • 1
    Forgive me for asking but why not just use a NSPopover? (especially since Apple say that you should avoid masking NSVisualEffectView) – David Rönnqvist Sep 11 '14 at 20:40
  • @DavidRönnqvist its to do with the way that the window has a scrollview thats masked, the arrow below the icon is actually a part of the content view and the text will pass through it. NSPopover doesn't mask its content so anything that tries to render itself within the arrow gets clipped. – Luke Sep 11 '14 at 21:04
  • 1
    Also, an NSPopover actually creates a slightly different effect than a NSVisualEffectView. Here's an example: https://devforums.apple.com/message/1061741#1061741. Another example: the OS X menubar has the same blur effect as a NSVisualEffectView whereas the NSMenus look more similar to an NSPopover. If you simply open an menu in the menubar then you can easily see the difference between the two effects. – iMaddin Mar 11 '15 at 22:57
  • Possible duplicate of [How to make a smooth, rounded, volume-like OS X window with NSVisualEffectView?](https://stackoverflow.com/questions/26518520/how-to-make-a-smooth-rounded-volume-like-os-x-window-with-nsvisualeffectview) – s4y Jul 30 '17 at 23:53

1 Answers1

0

I was trying to achieve this with a NSWindow view a while back and I came across this awesome library: https://www.cocoacontrols.com/controls/waythedarkside

It allows you to add a light or dark blur to your view/background. I think this is what you are looking for :)