Re: NSVisualEffectView & NSVisualEffectBlendingModeBehindWindow & transparency
Re: NSVisualEffectView & NSVisualEffectBlendingModeBehindWindow & transparency
- Subject: Re: NSVisualEffectView & NSVisualEffectBlendingModeBehindWindow & transparency
- From: Corbin Dunn <email@hidden>
- Date: Mon, 05 Jan 2015 15:58:02 -0800
> On Dec 26, 2014, at 2:26 AM, Jacek Oleksy <email@hidden> wrote:
>
> Hi,
> I add vibrancy effect to my window using the following code:
>
> In the view class:
> - (void)awakeFromNib {
> NSVisualEffectView* vibrantView = [[NSVisualEffectView alloc]
> initWithFrame:self.frame];
> vibrantView.appearance = [NSAppearance
> appearanceNamed:NSAppearanceNameVibrantLight];
> [vibrantView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
> [self addSubview:vibrantView];
> }
>
> It uses default blending mode (which is
> NSVisualEffectBlendingModeBehindWindow), and this is what I need.
>
> Problem: the vibrancy effect goes right to the bottom of the desktop,
> i.e. the color of desktop background color shines through (even if
> there are some other windows in the way!).
This is the explicit HI design; it includes a certain percentage of the desktop image in the blur.
>
> The effect that I need is to have the transparency effect include only
> the top visible window, this is how NSPopover works:
>
> In view controller:
> @interface PopoverController : NSViewController {
> }
> @end
> @implementation PopoverController
> - (void)loadView {
> self.view = [[NSView alloc] initWithFrame:NSMakeRect(10,10,100,100)];
> }
> @end
> - (void) viewDidAppear {
> NSPopover* popover = [[NSPopover alloc] init];
> PopoverController* controller =[[PopoverController alloc] init];
> [popover setContentViewController:controller];
> [popover setBehavior:NSPopoverBehaviorTransient];
> [popover showRelativeToRect:self.view.bounds ofView:self.view
> preferredEdge:NSMaxYEdge];
> }
>
> The popup that is created gets the vibrancy effect only from the
> window that is right below it.
>
> Any ideas on how to make it work for custom window?
There is not any API to control this option. Please log a bug requesting this ability.
Thanks,
corbin
>
> Thanks,
> Jacek
> _______________________________________________
>
> 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
_______________________________________________
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