Re: See-through effect (ala Terminal, iPhoto HUD windows, Disco)
Re: See-through effect (ala Terminal, iPhoto HUD windows, Disco)
- Subject: Re: See-through effect (ala Terminal, iPhoto HUD windows, Disco)
- From: Michael Watson <email@hidden>
- Date: Mon, 15 Jan 2007 10:20:59 -0500
I achieve this effect in a few of my applications, without generating
erroneous shadows. In the initialization method of my custom window,
I do this:
[self setOpaque:NO];
[self setBackgroundColor:[self hudBackground]];
The -hudBackground method generates a non-opaque image that is
painted into the background of the window. I leave the alpha value of
the window at 1.0.
--
m-s
On 15 Jan, 2007, at 04:49, David Aames wrote:
Hello all,
I'd say that this is my last attempt to ask about this on the list.
Basically what I'm trying to achieve is the HUD window effect in
iPhoto/transparency in Terminal. I've tried several approaches to
no avail.
Here's what I've attempted:
1. Implement a NSWindow subclass with a custom frame (what
iLifeControls &
OpenHUD does). This works perfectly to give the look but there is
one big
problem - because the NSViews lie on the window and the window
background is
not opaque and transparent all NSViews drop a shadow. So basically
if you
move a slider in iLifeControls/OpenHUD it leaves a ghosting effect.
The only
way around this is to invalidate the shadow on every redraw but
that is so
inefficient that the slider is almost unusable.
2. Use child windows. As described here
http://www.cocoabuilder.com/archive/message/cocoa/2007/1/13/177105
there is
bug which prevents using this method. (
http://www.cocoabuilder.com/archive/message/cocoa/2007/1/10/176913)
Ideally what I need to implement is a kind of see-through view so
the window
actually think that the area is fully opaque but actually isn't.
Take a look
at Terminal with transparency - you cannot see the titlebar dropping a
shadow so somehow the window thinks that the area is not
transparent. So
ideally I need a way to fool the window to draw its shadow only
around its
border and not under the window.
I've been using Quartz Debug to try and figure out how the other
apps are
doing it and it seems that they're using hidden windows to do some
magic -
not sure how they're being used to achieve that effect.
This question has been asked numerous times on the list and it
seems that no
one wants to uncover their way of doing it (which is a pity
really). Please,
can some of the holy Cocoa gurus on the list enlighten us all on
_how_ to
achieve this (not code, just guidelines)? I'm truly thankful to
anyone who
can offer some help on this.
Kind regards,
David
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
40bungie.org
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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