Re: Window With Transparent Background
Re: Window With Transparent Background
- Subject: Re: Window With Transparent Background
- From: Richard Charles <email@hidden>
- Date: Tue, 24 Jan 2017 20:41:24 -0700
> On Jan 24, 2017, at 6:58 PM, Ken Thomases <email@hidden> wrote:
>
> I can't explain the differences in the two cases, but are you also setting the window's opaque property to NO? If not, then setting the background color to partially transparent is not sufficient to reliably make a window transparent.
That was a really good suggestion but unfortunately it does not work.
[window setOpaque:NO]; // makes no difference
After further investigation here is what I found out.
Using the window background color property is unreliable with or without alpha. For example some rgb component values less than 1.0 are clamped. Also rgb components must conform to certain requirements to successfully produce a transparent background. A single color component value of rgb must be 1.0 or less as expected. However two color component values of rgb must be 0.588 or less and three color component values of rgb must be 0.572 or less to successfully produce a transparent background.
A solution that works it to replace the window content view with a custom view that has a background color property.
http://stackoverflow.com/questions/33595674/set-background-color-of-nswindow-with-appearance-set
--Richard Charles
_______________________________________________
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