Re: Drawing in a view with alpha 1.0 shows windows behind

2015-03-31 Thread Charles Jenkins
Eyal,

I don’t have an answer for you, just a request for clarification. If a view has 
a low alpha setting, you expect the content behind it to show through, so your 
description sounds like normal behavior. However, I suspect you’re dealing with 
a real problem.

Are you saying that your view with low alpha is above other content in your 
app, but instead of the information which *should* show through, Yosemite is 
blending with other content—content from windows or the desktop behind your app?

-- 

Charles

On March 31, 2015 at 08:59:48, Charles Jenkins (cejw...@gmail.com) wrote:

Eyal,

I don’t have an answer for you, just a request for clarification. If a view has 
a low alpha setting, you expect the content behind it to show through, so your 
description sounds like normal behavior. However, I suspect you’re dealing with 
a real problem.

Are you saying that your view with low alpha is above other content in your 
app, but instead of the information which *should* show through, Yosemite is 
blending with other content—content from windows or the desktop behind your 
app? 

-- 

Charles

On March 31, 2015 at 08:42:30, Eyal Redler (eyred...@netvision.net.il) wrote:

Hi,

I'm working on a custom view. I'm using the following code to draw the view

[[NSColor colorWithDeviceRed:(float)42/255
green:(float)49/255
blue:(float)58/255
alpha:0.5] set];
NSRectFill([self bounds]);

[[NSColor colorWithDeviceRed:(float)242/255
green:(float)110/255
blue:(float)80/255
alpha:1.0] set];

NSFrameRect([self bounds]);

For some reason the view is showing through the windows/desktop behind the 
window where my view is located.
Surly this is a manifestation of one of the (somewhat unwanted IMO) features of 
Yosemite but I've not been able to find where I can opt out of this.
The window I'm drawing to is a custom window, if that matters

TIA

Eyal ___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/cejwork%40gmail.com

This email sent to cejw...@gmail.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Drawing in a view with alpha 1.0 shows windows behind

2015-03-31 Thread Charles Jenkins
Whoops. Sorry to everyone about the doubled-up email. I had a problem with my 
email program and thought the first reply didn’t send, so I tried again, and 
apparently it went out as a reply to my own reply :-(

-- 

Charles
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Drawing in a view with alpha 1.0 shows windows behind

2015-03-31 Thread Mike Abdullah

 On 31 Mar 2015, at 15:59, Charles Jenkins cejw...@gmail.com wrote:
 
 I confused the view with the color, but in essence that’s what I was afraid 
 you were saying: that Yosemite is blending with unrelated content instead of 
 what is layered by your app/view/window/whatever “under” the rectangle you’re 
 trying to fill.
 
 I believe you should file a bug report on this.

Nope, this is the intended design.

The standard drawing model for Cocoa on OS X is that views draw into a single 
context for the whole window. Normally then views draw their content *atop* any 
existing content, so as to build up the correct result. e.g. you composite a 
translucent colour *over* the existing graphics there.

By using NSRectFill you are instead *replacing* whatever is there with your 
translucent colour. Consequently, whatever is behind the window is now free to 
appear through that translucency. As Uli said, you want to use a different 
compositing operation, to give the correct result.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Drawing in a view with alpha 1.0 shows windows behind

2015-03-31 Thread Jens Alfke

 On Mar 31, 2015, at 5:39 AM, Eyal Redler eyred...@netvision.net.il wrote:
 
 For some reason the view is showing through the windows/desktop behind the 
 window where my view is located.
 Surly this is a manifestation of one of the (somewhat unwanted IMO) features 
 of Yosemite

Nope, it’s always been that way. I remember running into this effect back in 
2001 or 2002.

—Jens
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Drawing in a view with alpha 1.0 shows windows behind

2015-03-31 Thread Uli Kusterer

 On 31 Mar 2015, at 14:39, Eyal Redler eyred...@netvision.net.il wrote:
 I'm working on a custom view. I'm using the following code to draw the view
   
   [[NSColor colorWithDeviceRed:(float)42/255
  green:(float)49/255
   blue:(float)58/255
  alpha:0.5] set];
   NSRectFill([self bounds]);
   
   [[NSColor colorWithDeviceRed:(float)242/255
  green:(float)110/255
   blue:(float)80/255
  alpha:1.0] set];
   
   NSFrameRect([self bounds]);

NSRectFill uses the context's default compositing operation, which usually is 
NSCompositeCopy. You probably want to use NSRectFillUsingOperation( box, 
NSCompositeSourceAbove ) or so. (this is from memory, it might be a different 
compositing mode, but it's definitely not Copy)
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Drawing in a view with alpha 1.0 shows windows behind

2015-03-31 Thread Charles Jenkins
I confused the view with the color, but in essence that’s what I was afraid you 
were saying: that Yosemite is blending with unrelated content instead of what 
is layered by your app/view/window/whatever “under” the rectangle you’re trying 
to fill.

I believe you should file a bug report on this.

-- 

Charles

On March 31, 2015 at 10:33:04, Eyal Redler (e...@beamr.com) wrote:

First, I'm not setting the alpha for the view, I'm setting a color with 0.5 
alpha and using that to fill the view (code is from drawRect).  

Second, and more importantly, my problem is not that content is showing through 
the view (that is the purpose), the problem is that what's showing through is 
not the right content: I'm seeing other windows and the desktop insetad of 
seeing what's painted on the superview, the superview's superview etc.  
To clarify, one of my view's superviews is painted opaque below that view so 
it's not a case where we have transparency all the way down to the window.  

Eyal  



 On Mar 31, 2015, at 4:01 PM, Charles Jenkins cejw...@gmail.com wrote:  
  
 Eyal,  
  
 I don’t have an answer for you, just a request for clarification. If a view 
 has a low alpha setting, you expect the content behind it to show through, so 
 your description sounds like normal behavior. However, I suspect you’re 
 dealing with a real problem.  
  
 Are you saying that your view with low alpha is above other content in your 
 app, but instead of the information which *should* show through, Yosemite is 
 blending with other content—content from windows or the desktop behind your 
 app?  
  
 --  
  
 Charles  
  
 On March 31, 2015 at 08:42:30, Eyal Redler (eyred...@netvision.net.il) wrote: 
  
  
 Hi,  
  
 I'm working on a custom view. I'm using the following code to draw the view  
  
 [[NSColor colorWithDeviceRed:(float)42/255  
 green:(float)49/255  
 blue:(float)58/255  
 alpha:0.5] set];  
 NSRectFill([self bounds]);  
  
 [[NSColor colorWithDeviceRed:(float)242/255  
 green:(float)110/255  
 blue:(float)80/255  
 alpha:1.0] set];  
  
 NSFrameRect([self bounds]);  
  
 For some reason the view is showing through the windows/desktop behind the 
 window where my view is located.  
 Surly this is a manifestation of one of the (somewhat unwanted IMO) features 
 of Yosemite but I've not been able to find where I can opt out of this.  
 The window I'm drawing to is a custom window, if that matters  
  
 TIA  
  
 Eyal ___  
  
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)  
  
 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:  
 https://lists.apple.com/mailman/options/cocoa-dev/cejwork%40gmail.com  
  
 This email sent to cejw...@gmail.com  
 ___  
  
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)  
  
 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:  
 https://lists.apple.com/mailman/options/cocoa-dev/eyredler%40netvision.net.il 
  
  
 This email sent to eyred...@netvision.net.il  

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Drawing in a view with alpha 1.0 shows windows behind

2015-03-31 Thread Eyal Redler
Thanks Uli, Using 
NSRectFillUsingOperation( box, NSCompositeSourceAtop )
did the trick.

Thanks to all who answered. I've been developing for mac for over 20 years and 
I find it really odd that I've never came across this behaviour.

Eyal


 On Mar 31, 2015, at 4:42 PM, Uli Kusterer witness.of.teacht...@gmx.net 
 wrote:
 
 
 On 31 Mar 2015, at 14:39, Eyal Redler eyred...@netvision.net.il wrote:
 I'm working on a custom view. I'm using the following code to draw the view
  
  [[NSColor colorWithDeviceRed:(float)42/255
 green:(float)49/255
  blue:(float)58/255
 alpha:0.5] set];
  NSRectFill([self bounds]);
  
  [[NSColor colorWithDeviceRed:(float)242/255
 green:(float)110/255
  blue:(float)80/255
 alpha:1.0] set];
  
  NSFrameRect([self bounds]);
 
 NSRectFill uses the context's default compositing operation, which usually is 
 NSCompositeCopy. You probably want to use NSRectFillUsingOperation( box, 
 NSCompositeSourceAbove ) or so. (this is from memory, it might be a different 
 compositing mode, but it's definitely not Copy)



smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Drawing in a view with alpha 1.0 shows windows behind

2015-03-31 Thread Lee Ann Rucker
It also depends on your window’s transparency settings, which you don’t always 
control - Apple changed that on the window that holds the toolbar accessory in 
fullscreen, changing my patterned grab zone into a bunch of tiny ungrabbable 
holes :(

On Mar 31, 2015, at 2:53 PM, Eyal Redler eyred...@netvision.net.il wrote:

 Thanks Uli, Using 
 NSRectFillUsingOperation( box, NSCompositeSourceAtop )
 did the trick.
 
 Thanks to all who answered. I've been developing for mac for over 20 years 
 and I find it really odd that I've never came across this behaviour.
 
 Eyal
 
 
 On Mar 31, 2015, at 4:42 PM, Uli Kusterer witness.of.teacht...@gmx.net 
 wrote:
 
 
 On 31 Mar 2015, at 14:39, Eyal Redler eyred...@netvision.net.il wrote:
 I'm working on a custom view. I'm using the following code to draw the view
 
 [[NSColor colorWithDeviceRed:(float)42/255
green:(float)49/255
 blue:(float)58/255
alpha:0.5] set];
 NSRectFill([self bounds]);
 
 [[NSColor colorWithDeviceRed:(float)242/255
green:(float)110/255
 blue:(float)80/255
alpha:1.0] set];
 
 NSFrameRect([self bounds]);
 
 NSRectFill uses the context's default compositing operation, which usually 
 is NSCompositeCopy. You probably want to use NSRectFillUsingOperation( box, 
 NSCompositeSourceAbove ) or so. (this is from memory, it might be a 
 different compositing mode, but it's definitely not Copy)
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/lrucker%40vmware.com
 
 This email sent to lruc...@vmware.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com