Re: How make image nonvibrant in Yosemite NSVisualEffectView
Re: How make image nonvibrant in Yosemite NSVisualEffectView
- Subject: Re: How make image nonvibrant in Yosemite NSVisualEffectView
- From: Bill Cheeseman <email@hidden>
- Date: Thu, 30 Oct 2014 15:56:55 -0400
> On Oct 30, 2014, at 3:28 PM, Quincey Morris <email@hidden> wrote:
>
> Maybe this is too simplistic, but isn’t there a solution where the icons are subviews of another view that has vibrancy turned off, not directly of the window content view?
>
> Or, in the worst case, a two-window solution where the icons are in a non-vibrant window positioned over the vibrant background window?
The problem is that using a nonvibrant subview or window yields a nonvibrant area that is in the shape of a rectangle. The Appkit Release Note discusses techniques like those you suggest, but it expressly calls out the limitation to rectangular effects. What I want is a nonvibrant image with an irregular shape, namely, the shape of the nontransparent parts of any application icon. Apple does that in Yosemite's Application Switcher.
I'm going to go ahead a use the rectangular approach for now, because there is a wide border area of my window around the icon which will still show vibrancy. But I would like to find a way to do it like Application Switcher.
> Because … it’s an issue of creating masks generally, or of getting icon-shaped bitmaps in particular?
My images are application icons obtained using -[NSWorkspace iconForFile:]. Like most application icons, they usually have irregularly shaped nontransparent areas. I want to create a rectangular mask with a hole in it, where the hole is in the shape of the nontransparent areas of the icon. Ideally a 1-bit mask. Assigning the mask to NSVisualEffectView's maskImage property will allow everything covered by the rectangular mask (namely the whole window) to show vibrancy, except that the area in the hole (namely, the icon shape) will not show vibrancy. At least, that's how I understand the discussion of maskImage in the AppKit Release Note or the WWDC 220 video. (I have already applied a rectangular maskImage with rounded corners, and it removes the square corners from the NSVisualEffectView perfectly.)
--
Bill Cheeseman - email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden