Re: Transparent sheets in Snow Leopard

Eric Peyton <epeyton-FXW0A4QGDABWk0Htik3J/[email protected]>
Newsgroups gmane.comp.macosx.devel
Message-ID <[email protected]>
On Sep 19, 2009, at 5:40 AM, Trent Jacobs wrote:

> Hi all,
>
> I've written an application where I have a transparent sheet showing  
> over a window. I use this to show text (or other things as well)  
> over either a background image or a video.
>
> To make the background of the sheet transparent I sublcassed  
> NSWindow and used the following:
>
> / 
> *******************************************************************************
> * Function:    initWithContentRect
> *
> * Returns:     id of transparent window
> *
> * Description: Sets up the values to make the window transparent
> *
> ******************************************************************************/
> - (id) initWithContentRect : (NSRect) contentRect
> 				 styleMask : (unsigned int) aStyle
> 				   backing : (NSBackingStoreType) bufferingType
> 					 defer : (BOOL) flag
> {
>    NSWindow* result = [super initWithContentRect : contentRect
> 										styleMask : NSBorderlessWindowMask
> 										  backing : NSBackingStoreBuffered
> 											defer : NO];
>    [result setBackgroundColor: [NSColor clearColor]];
>    [result setLevel: NSStatusWindowLevel];
>    [result setAlphaValue:1.0];
>    [result setOpaque:NO];
>    [result setHasShadow: NO];
>    return result;
> }
>
> This has always worked for me, but now when the sheet is showing,  
> the area covered by the transparent sheet is blurred. I've uploaded  
> a screenshot to http://www.jacobs.co.za/BlurredSheet.png
>
> I've recently upgraded to snow leopard and I don't remember this  
> happening in tiger or leopard, but that may just be a coincidence.
>
> Can anyone help me out? Thanks in advance!

This is behaving correctly in SnowLeopard.  Sheets have a blurred  
background behind them by default now.  You will want to create the  
window the same way and attach it using other methods than as a sheet  
(Which I suggest anyway give the HI you are showing.  There is no need  
to use a sheet - an attached window would do just fine).  (See  
NSWindow.h - addChildWindow:ordered:).

Eric

>
> Trent.
> _______________________________________________
> MacOSX-dev mailing list
> [email protected]
> http://www.omnigroup.com/mailman/listinfo/macosx-dev
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.