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: David Aames <email@hidden>
- Date: Mon, 15 Jan 2007 20:52:56 +0000
Hi list,
Firstly I would like *thank* everyone who replied - it is much
appreciated. Now onto the main bit.
Matt Gemmell's HUD window does indeed not exhibit the ghosting
effect. Thanks to all who suggested it (I was aware of it) and the
reason I wasn't happy with the implementation is that it seemed like
a hack (and there wasn't something else which I can't remember from
the top of my head). I need to _stress_ the fact that this is my
*personal* opinion - the implementation works and it's nice trick
which I wasn't aware of. For some reason I prefer subclassing
NSTitledFrame (which is private again, what a surpise!) which isn't
necessarily a better way of doing it having in mind the visibility of
NSTitledFrame although I just feel that it is the proper way of
providing a custom look for a window.
My second reason for not going with Matt's solution is that doesn't
actually allow me to do what disabling the shadow for the content
does - it provides much more flexibility. For example emulating the
look of Terminal took about 20 seconds and here's the result:
1. With disabled shadow for content - http://www.mediamax.com/
david_aames/Hosted/Picture 4.png (thanks to private goodness)
2. Without disabled shadow for content - http://www.mediamax.com/
david_aames/Hosted/Picture 5.png
Once again thanks to everyone and bear in mind that this is my
personal opinion on Matt's HUD implementation and it does in no way
affect all the respect I have for him. Thank you for making cocoa-dev
the place it is.
Kind regards,
David
On 15 Jan 2007, at 15:20, Michael Watson wrote:
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