Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > trasparent custom window

trasparent custom window
Thread Tools
lenz
Registered User
Join Date: Apr 2001
Status: Offline
Reply With Quote
Dec 6, 2001, 09:38 PM
 
I'm wondering if anyone could post a code snippet that would create a custom window with a transparency of say .5. I have no experience whatsoever with Quartz and the documentation is starting to make my head hurt. I know my Quickdraw basics fairly well...but nothing too too fancy.
Thanx!
     
Ghoser777
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status: Offline
Reply With Quote
Dec 6, 2001, 10:01 PM
 
it's pretty easy. Just set the window's alpha channel to be .5.

i.e.

<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
CustomWindow window = new Custom Window(blah blah blah ...);
window.setAlphaValue((float).<font color = blue>5</font>);
</font>[/code]

or

<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
CustomWindow* window = [[CustomWindow alloc] init...];
[window setAlphaValue:.<font color = blue>5</font>];
</font>[/code]
That should be it.

HTH,
F-bacher

I hate UBB and how it deals with code

[ 12-06-2001: Message edited by: Ghoser777 ]

[ 12-06-2001: Message edited by: Ghoser777 ]
     
sadie
Senior User
Join Date: Feb 2001
Location: Rochester, uk
Status: Offline
Reply With Quote
Dec 12, 2001, 07:25 AM
 
Wow, impressively short code. Out of curiosity, how hard would this be to do in Carbon? How about in Classic? Windows? Swing?

Let's see just how they really do compare...
All words are lies. Including these ones.
     
tie
Professional Poster
Join Date: Feb 2001
Status: Offline
Reply With Quote
Dec 13, 2001, 04:18 PM
 
One neat trick is to set the window transparency to 0.999 (some number close to one). Then solid images drawn in the window look completely solid, while partially transparent images draw over the background. This lets you have different areas of the window have different transparencies.

So, for example, you can have custom window shapes, e.g., http://www.versiontracker.com/morein...d=10631&db=mac .
The 4 o'clock train will be a bus.
It will depart at 20 minutes to 5.
     
   
Thread Tools
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 11:51 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,