Re: Semi-transparent, blurred NSWindow background?
On 26 Aug 2008, at 00:52, Graham Cox wrote: On 26 Aug 2008, at 8:00 am, Jonathan Dann wrote: Using the private APIs / the method that Rob showed is perfectly fast. I'd really like this made easier too, so I filed an enhancement request rdar://6174287 Is it possible to file a de-enhancement request? ;-) Nice, I usually resist writing LOL, but that did make me LOL! Am I the only one mystified by the attraction of this particular effect? It burns CPU/GPU time like there's no tomorrow for no apparent benefit to the usability of the UI. The original idea of semi-transparent windows seems a good one - you can still read some of the content behind which can enhance usability when you need a quick reminder of what's there without having to activate the window. For example there are times when you have no choice but to retype something you can see in one window and enter it in a field in another (admittedly these times have got a lot rarer with static text being often selectable/copyable, but it still happens). With blurring, the ability to do that has been wiped out in a lot of cases. Why? What's the metaphor for a blurring window? Frosted glass? How many windows in the real world use frosted glass? Not many in proportion to transparent glass, that's for sure. When I first saw Vista I chuckled at the widespread use of the blurring effect because it seemed like those guys had introduced some gratuitous eye-candy without getting in any way why they'd done it. I was sorry to see that the joke was on us in Leopard. Leopard's blurring is subtler than Vista's, so let's be grateful for small mercies - but I do think we ought to be debating why we have this at all. A public API for this would mean that every man and his dog will be adding blurring because it's "cool" without thinking about what it *means*. It's going to be the brushed metal of the next few OS revs I fear. I know what you mean. It's a very fine line to tread when working on a GUI app, but I'm not convinced that *absolutely* everything has to mean something, just the overwhelming majority. I think in this case its one of those things that does add a nice touch to the UI, if used very sparingly. In the case of a contextual menu I think that transparency would be wrong as the user is trying to read the menu text and too much of the masked (for example) text view below would be distracting. I quite like the subtlety of the blurring, and come to think of it, it may imply that the view that blurs is a transient one. I don't keep menus open for long enough for the CPU usage to be an issue, and I don't think many would. As always, I'm open to a rebuke! :) Take care, Jonathan http://espresso-served-here.com 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Semi-transparent, blurred NSWindow background?
On Mon, Aug 25, 2008 at 7:52 PM, Graham Cox <[EMAIL PROTECTED]> wrote: > A public API for this would mean that every man and his dog will be adding > blurring because it's "cool" without thinking about what it *means*. It's > going to be the brushed metal of the next few OS revs I fear. Better ask Apple to remove it from every sheet and menu, where it's currently in use. :-) --Kyle Sluder ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Semi-transparent, blurred NSWindow background?
On Mon, Aug 25, 2008 at 7:52 PM, Graham Cox <[EMAIL PROTECTED]> wrote: > A public API for this would mean that every man and his dog will be adding > blurring because it's "cool" without thinking about what it *means*. It's > going to be the brushed metal of the next few OS revs I fear. The same basic thing was said about transparency, and although there were some poor uses in the early days of Mac OS X, it turned out to be somewhat overblown. If you ask me, programmers who want to make a bad GUI will do so no matter what the tools at hand. Mike ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Semi-transparent, blurred NSWindow background?
On 26 Aug 2008, at 8:00 am, Jonathan Dann wrote: Using the private APIs / the method that Rob showed is perfectly fast. I'd really like this made easier too, so I filed an enhancement request rdar://6174287 Is it possible to file a de-enhancement request? ;-) Am I the only one mystified by the attraction of this particular effect? It burns CPU/GPU time like there's no tomorrow for no apparent benefit to the usability of the UI. The original idea of semi- transparent windows seems a good one - you can still read some of the content behind which can enhance usability when you need a quick reminder of what's there without having to activate the window. For example there are times when you have no choice but to retype something you can see in one window and enter it in a field in another (admittedly these times have got a lot rarer with static text being often selectable/copyable, but it still happens). With blurring, the ability to do that has been wiped out in a lot of cases. Why? What's the metaphor for a blurring window? Frosted glass? How many windows in the real world use frosted glass? Not many in proportion to transparent glass, that's for sure. When I first saw Vista I chuckled at the widespread use of the blurring effect because it seemed like those guys had introduced some gratuitous eye-candy without getting in any way why they'd done it. I was sorry to see that the joke was on us in Leopard. Leopard's blurring is subtler than Vista's, so let's be grateful for small mercies - but I do think we ought to be debating why we have this at all. A public API for this would mean that every man and his dog will be adding blurring because it's "cool" without thinking about what it *means*. It's going to be the brushed metal of the next few OS revs I fear. Just my 2¢ worth... Graham___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Semi-transparent, blurred NSWindow background?
On 25 Aug 2008, at 21:51, Seth Willits wrote: On Aug 25, 2008, at 1:33 PM, Ricky Sharp wrote: There isn't a particularly fast way to do this, although I have experimented with it a bit in the past. You can use the CGWindow API to read the contents under your window and apply a blur to them using Core Image directly or indirectly via Core Animation, but in either case you'll see the Window Server spending considerably more CPU time as it has to re-render the contents under your window. You could fake it by updating the image rarely but there isn't a particularly good way to completely mitigate the CPU usage. Hmm... it's very hard to tell, but I believe there must be a fast way that already exists. I'm sure he meant a fast *public* way to do it. Using the private APIs / the method that Rob showed is perfectly fast. I'd really like this made easier too, so I filed an enhancement request rdar://6174287 Jonathan http://espresso-served-here.com 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Semi-transparent, blurred NSWindow background?
On Aug 25, 2008, at 1:33 PM, Ricky Sharp wrote: There isn't a particularly fast way to do this, although I have experimented with it a bit in the past. You can use the CGWindow API to read the contents under your window and apply a blur to them using Core Image directly or indirectly via Core Animation, but in either case you'll see the Window Server spending considerably more CPU time as it has to re-render the contents under your window. You could fake it by updating the image rarely but there isn't a particularly good way to completely mitigate the CPU usage. Hmm... it's very hard to tell, but I believe there must be a fast way that already exists. I'm sure he meant a fast *public* way to do it. Using the private APIs / the method that Rob showed is perfectly fast. -- Seth Willits ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Semi-transparent, blurred NSWindow background?
I believe the built-in stuff (menus, sheets, etc.) uses the private functions mentioned earlier. Honestly, if you really need this function to work exactly the same, AFAIK the private stuff is the only real way to do it. Simulating it via a custom NSView just seems really hackish and error-prone to me, all "it's private so don't rely on it" (which is a good guideline) advice aside. Think about if potential future breakage is worth it, and of course, pushing for a public API is probably the best way to do it—if you can wait that long. /grainofsalt On Aug 25, 2008, at 3:33 PM, Ricky Sharp wrote: On Aug 25, 2008, at 12:57 PM, David Duncan wrote: On 25/08/2008, at 2:45 AM, Tim Andersson wrote: Is there any way of creating a NSWindow that has a semi- transparent, blurred background? With "blurred background" I mean that whatever you see through the window/background is distorted (blurred). There isn't a particularly fast way to do this, although I have experimented with it a bit in the past. You can use the CGWindow API to read the contents under your window and apply a blur to them using Core Image directly or indirectly via Core Animation, but in either case you'll see the Window Server spending considerably more CPU time as it has to re-render the contents under your window. You could fake it by updating the image rarely but there isn't a particularly good way to completely mitigate the CPU usage. Hmm... it's very hard to tell, but I believe there must be a fast way that already exists. I just played a QT movie (Apple's 20th anniv '1984') and then pulled down a menu (File) over the top of it. For users of Leopard, the menu background 'blurs' what's behind it. In the case of a QT movie, the menu's contents are definitely upgraded for each new frame. It was very difficult to tell if each frame was truly blurred. But for the portion of the movie that rolls the "On January 24th.." text, the text definitely appeared to be blurred. ___ Ricky A. Sharp mailto:[EMAIL PROTECTED] Instant Interactive(tm) http://www.instantinteractive.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Semi-transparent, blurred NSWindow background?
On Aug 25, 2008, at 12:57 PM, David Duncan wrote: On 25/08/2008, at 2:45 AM, Tim Andersson wrote: Is there any way of creating a NSWindow that has a semi- transparent, blurred background? With "blurred background" I mean that whatever you see through the window/background is distorted (blurred). There isn't a particularly fast way to do this, although I have experimented with it a bit in the past. You can use the CGWindow API to read the contents under your window and apply a blur to them using Core Image directly or indirectly via Core Animation, but in either case you'll see the Window Server spending considerably more CPU time as it has to re-render the contents under your window. You could fake it by updating the image rarely but there isn't a particularly good way to completely mitigate the CPU usage. Hmm... it's very hard to tell, but I believe there must be a fast way that already exists. I just played a QT movie (Apple's 20th anniv '1984') and then pulled down a menu (File) over the top of it. For users of Leopard, the menu background 'blurs' what's behind it. In the case of a QT movie, the menu's contents are definitely upgraded for each new frame. It was very difficult to tell if each frame was truly blurred. But for the portion of the movie that rolls the "On January 24th.." text, the text definitely appeared to be blurred. ___ Ricky A. Sharp mailto:[EMAIL PROTECTED] Instant Interactive(tm) http://www.instantinteractive.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Semi-transparent, blurred NSWindow background?
On 25 Aug 2008, at 16:58, Tim Andersson wrote: 24 aug 2008 kl. 23.20 skrev Jonathan Dann: On 24 Aug 2008, at 17:45, Tim Andersson wrote: YMMV but I'd start with a window as shown in this sample code http://developer.apple.com/samplecode/RoundTransparentWindow/index.html and then replace the view with a custom view, and apply a CI filter as shown here http://www.kickingbear.com/blog/?m=200803 Hope this helps, let me know how you get on if that's ok? Jonathan http://espresso-served-here.com I'm not getting on very well.. I don't understand how I'm supposed to apply the CIFilter to my custom view. What is the "concept" of applying the filter? For example, the concept of applying a CIFilter to a CIImage is roughly: Create a CIContext which will draw the image, create an CIImage, "apply" the CIFilter and draw the image using the CIContext. Many thanks, Tim Andersson That sounds right to me. It seems that you will have to make a transparent custom view and a transparent window. From there you make the view the content view of your transparent window. When it comes to drawing your transparent view you need to draw into CGLayers. As demonstrated in the sample code on http://www.kickingbear.com/blog/?m=200803 draw your view first into a GCLayer, see -lockFocusOnViewLayer. Then lock focus on your own custom view's "mask" layer and fill the bounds of your view with [NSColor whiteColor]. Then you have the job of post processing what you just filled (the mask image). The steps in the application of a CIIFilter to an image are described here: http://developer.apple.com/documentation/GraphicsImaging/Conceptual/CoreImaging/ci_tasks/chapter_3_section_5.html#/ /apple_ref/doc/uid/TP30001185-CH203-BAJDDCEE which I won't re-hash 'cos I'm not confident enough with CoreImage not to butcher it. But have a look at the sample code on the kickingbear blog, the application is carried out in the -[KBPostProcessedTableView applyPostProcess] methods. Which creates a CIFilter with CIBlendWithMask, and draws the output image into a CIContext. Hope that's a little clearer. Jonathan http://espresso-served-here.com 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Semi-transparent, blurred NSWindow background?
On 25/08/2008, at 2:45 AM, Tim Andersson wrote: Is there any way of creating a NSWindow that has a semi-transparent, blurred background? With "blurred background" I mean that whatever you see through the window/background is distorted (blurred). There isn't a particularly fast way to do this, although I have experimented with it a bit in the past. You can use the CGWindow API to read the contents under your window and apply a blur to them using Core Image directly or indirectly via Core Animation, but in either case you'll see the Window Server spending considerably more CPU time as it has to re-render the contents under your window. You could fake it by updating the image rarely but there isn't a particularly good way to completely mitigate the CPU usage. On Aug 24, 2008, at 9:13 PM, Rob Keniger wrote: In 10.5 you can add any core image filter to a window using the private function 'CGSAddWindowFilter'. Please do not use private API, they are subject to change in ways that can break your application on any OS update. File a feature enhancement request describing what you wish to do instead. -- David Duncan Apple DTS Animation and Printing ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Semi-transparent, blurred NSWindow background?
25 aug 2008 kl. 06.13 skrev Rob Keniger: >In 10.5 you can add any core image filter to a window using the >private function 'CGSAddWindowFilter'. > >typedef void * CGSConnectionID; > >extern OSStatus CGSNewConnection(const void **attr, CGSConnectionID >*id); > >- (void)enableBlurForWindow:(NSWindow *)window >{ > >CGSConnectionID _myConnection; >uint32_t __compositingFilter; > >int __compositingType = 1; // Apply filter to contents underneath the >window, then draw window normally on top > >/* Make a new connection to CoreGraphics, alternatively you could use >the main connection*/ > >CGSNewConnection(NULL , &_myConnection); > >/* The following creates a new CoreImage filter, then sets its options >with a dictionary of values*/ > >CGSNewCIFilterByName (_myConnection, (CFStringRef)@"CIGaussianBlur", >&__compositingFilter); >NSDictionary *optionsDict = [NSDictionary dictionaryWithObject: >[NSNumber numberWithFloat:3.0] forKey:@"inputRadius"]; >CGSSetCIFilterValuesFromDictionary(_myConnection, __compositingFilter, >(CFDictionaryRef)optionsDict); > >/* Now just switch on the filter for the window */ > >CGSAddWindowFilter(_myConnection, [window windowNumber], >__compositingFilter, __compositingType ); >} > >Insert standard disclaimer about using private Apple APIs here. > >-- >Rob Keniger Thanks for your help, but I'd like to stay away from the private APIs. :) //Tim Andersson PS. If this reply doesn't end up in my "thread", it's because your mail didn't end up in my inbox, so I had to create this email from scratch DS. ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Semi-transparent, blurred NSWindow background?
24 aug 2008 kl. 23.20 skrev Jonathan Dann: On 24 Aug 2008, at 17:45, Tim Andersson wrote: YMMV but I'd start with a window as shown in this sample code http://developer.apple.com/samplecode/RoundTransparentWindow/ index.html and then replace the view with a custom view, and apply a CI filter as shown here http://www.kickingbear.com/blog/?m=200803 Hope this helps, let me know how you get on if that's ok? Jonathan http://espresso-served-here.com I'm not getting on very well.. I don't understand how I'm supposed to apply the CIFilter to my custom view. What is the "concept" of applying the filter? For example, the concept of applying a CIFilter to a CIImage is roughly: Create a CIContext which will draw the image, create an CIImage, "apply" the CIFilter and draw the image using the CIContext. Many thanks, Tim Andersson ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Semi-transparent, blurred NSWindow background?
On Mon, Aug 25, 2008 at 12:13 AM, Rob Keniger <[EMAIL PROTECTED]> wrote: > Insert standard disclaimer about using private Apple APIs here. And, additionally, please file an enhancement request at http://bugreport.apple.com because this functionality seems quite handy. --Kyle Sluder ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Semi-transparent, blurred NSWindow background?
On 25/08/2008, at 2:45 AM, Tim Andersson wrote: Is there any way of creating a NSWindow that has a semi-transparent, blurred background? With "blurred background" I mean that whatever you see through the window/background is distorted (blurred). In 10.5 you can add any core image filter to a window using the private function 'CGSAddWindowFilter'. typedef void * CGSConnectionID; extern OSStatus CGSNewConnection(const void **attr, CGSConnectionID *id); - (void)enableBlurForWindow:(NSWindow *)window { CGSConnectionID _myConnection; uint32_t __compositingFilter; int __compositingType = 1; // Apply filter to contents underneath the window, then draw window normally on top /* Make a new connection to CoreGraphics, alternatively you could use the main connection*/ CGSNewConnection(NULL , &_myConnection); /* The following creates a new CoreImage filter, then sets its options with a dictionary of values*/ CGSNewCIFilterByName (_myConnection, (CFStringRef)@"CIGaussianBlur", &__compositingFilter); NSDictionary *optionsDict = [NSDictionary dictionaryWithObject: [NSNumber numberWithFloat:3.0] forKey:@"inputRadius"]; CGSSetCIFilterValuesFromDictionary(_myConnection, __compositingFilter, (CFDictionaryRef)optionsDict); /* Now just switch on the filter for the window */ CGSAddWindowFilter(_myConnection, [window windowNumber], __compositingFilter, __compositingType ); } Insert standard disclaimer about using private Apple APIs here. -- Rob Keniger ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Semi-transparent, blurred NSWindow background?
On 24 Aug 2008, at 17:45, Tim Andersson wrote: Hi there, Is there any way of creating a NSWindow that has a semi-transparent, blurred background? With "blurred background" I mean that whatever you see through the window/background is distorted (blurred). Any help is appreciated, Tim Andersson YMMV but I'd start with a window as shown in this sample code http://developer.apple.com/samplecode/RoundTransparentWindow/index.html and then replace the view with a custom view, and apply a CI filter as shown here http://www.kickingbear.com/blog/?m=200803 Hope this helps, let me know how you get on if that's ok? Jonathan http://espresso-served-here.com 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]