Slashdot Log In
Fast Alpha-Blending In Your GUI
Posted by
timothy
on Mon Nov 26, 2001 05:23 AM
from the alphablend-soup dept.
from the alphablend-soup dept.
visnu writes: "I've been waiting for this for 2 years now -- a REAL glass-like windowing system. And yes, it's Microsoft to do it. Ever since W2k came out, and they included alpha-blending in the GDI, I was tempted to write a little tool to turn on any window's transparency, but of course I'm way too lazy to do that. These guys weren't though: glass2k runs in the systray and handles turning on any window's transparency. yes, here's a screenshot. I'm not too sure about the speed in W2k, but in XP w/ the newest Nvidia drivers and a somewhat recent video card, it's hardware accelerated, and yes, you should be drooling." Update: 11/26 19:00 GMT by T : Links updated, so hopefully you'll be able to actually get to the content again :)
This discussion has been archived.
No new comments can be posted.
Fast Alpha-Blending In Your GUI
|
Log In/Create an Account
| Top
| 592 comments
(Spill at 50!) | Index Only
| Search Discussion
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
(1)
|
2
(1)
|
2
Re:Been There... (Score:4, Informative)
Windows 2000/XP also does this natively. It simply doesn't expose per-window control of it through the UI. Each window does have its own alpha level, and it's up to the programmer to decide if s/he wants all windows the same or not. For a good example, check out Lucidamp [daishar.com], a Winamp plugin that allows you to set varying levels of alpha transparency on each of the four main Winamp windows, and also works with the Mikroamp Winamp plugin.
Also, please note that Windows 2000 did this before OS X did this. Not that it matters, but it's true.
Great for always on top windows (Score:4, Insightful)
Great stuff, now implement it for NT4 and win98
Re:Great for always on top windows (Score:5, Insightful)
It is a pretty esy thing to do. For win32 programmers:
1. Find the window handle you want to alpha blend. (say, hwnd).
2. Add the WS_EX_LAYERED extended style to the window with this call:
SetWindowLong (hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED);
3. Call SetLayeredWindowAttributes. Look up MSDN for the info.
Also, this API in Win2k does not seem to work well in some video cards - windows which update themselves a lot will cause problems i.e. an opengl window, etc (my program has a few of them).
It's nice and all that... (Score:5, Insightful)
Re:It's nice and all that... (Score:5, Insightful)
Mac (Score:3, Informative)
Nothing new (Score:5, Informative)
It's rather cool, but not free, in either sense of the word.
Adding functionality not eye-candy (Score:5, Interesting)
One thing that they (GUI developers -- KDE, MS, Apple, etc) should implement RIGHT NOW is a feature I've seen on SGIs: A wheel widget that scales the contents of a file browser window. Even at 1600x1200 with a dinky font, I work with plenty of directories that just aren't easily navigable with a full-screen window. Too much scrolling. The ability to scale the contents of the window would be awesome, especially if it was coupled with a magnifying lens area arround the pointer.
Even normal windows with no content scaling would be more usable if we could hold a key and get a panning-type movement feature for windows with more content than screen space. I know plenty of applications do this, but this should be a base feature of the file management tools as well.
The point is, too many recent "developments" in GUIs seem to have more to do with making it fit stylistic or visual appearance goals and less with making the windowing system MORE USEFUL. Nice to look at makes it more enjoyable, but more useful means I can get the job done faster and get more time to look at something else.
Thanks, (Score:5, Funny)
it's vaguely interesting. (Score:4, Funny)
And I think it could be a little dangerous while surfing at work. You know, the boss comes around and you swiftly alt-tab to your work window...to find that it is 90% transparent.
Does look nice, though.
Just a thought,
Matt.
Let me bind this to a toggle key on my keyboard (Score:4, Interesting)
If this was bound to a key that was togglable on my keyboard, it would be nice. I could hit the key, and see where each window lies. Perhaps making the windows transparent and alt-tabbing through them while putting a red border on each one instead of having them pop up would be nice.
Whatever the case, it looks kind of hokey. I would like to see something like this where the widget graphics have alpha channels. Right now everything is one level of transparency. One step at a time, right?
XFree86's RENDER extension (Score:4, Informative)
Shiny! (Score:5, Funny)
And this is how we'll enter the brave new era of computing: Not by actually designing and using tools to make our lives more productive, convenient, and satisfying, but by slumping in our chairs and staring at useless eye-candy while we touch ourselves. I can't wait for the future.
Targetting specific apps (Score:3, Interesting)
Applying alpha blending to all windows is not really an interesting problem. There are some hoops to jump through, and you have to be realistic about what you expect, but otherwise it's a simple, straightforward process (don't believe me? This article [microsoft.com] gives you 90% of what you need to write such a tool. The other 10% is bookkeeping.)
More interesting is applying alpha blending to specific applications. This lets you be much more creative by doing something that complements an application. A translucent Internet Explorer is not interesting or useful (in fact, it's likely a drag on your system, and hard to read). A translucent Winamp [daishar.com], on the other hand, is a match made in heaven. What I'd really like to see is more application developers taking the time to add layered windows to their applications where it's appropriate, rather than taking this one-size-fits-all type of approach. But then, I've been playing with layered windows for a year and a half now, so maybe I'm just not getting the "wow" experience anymore.
OS X does this too ... (Score:4, Interesting)
Operation Brainfuck (Score:4, Insightful)
as not a good idea
creasingly being interested
ot to be confused with the
i.e. noise. The only purpose it serves is to faster identify the window you're dealing with. This has become unnecessary with the invention of the taskbar. Further additions to this concept, like window summarization and application-specific taskbars [kde.org], make it even easier to use. If you want to view a lot of information simultaneously instead of having everything in full-screen mode, a smart window-manager like ion [students.tut.fi] will rearrange windows automatically in useful tiles. Additional usability can be gained with clever hotkeys for application-switching.
But while overlapping windows are stupid, transparent windows are really part of a vast right-wing conspiracy to stupidify the masses by making computers incapable of displaying information. The next step will be window-spectific screensavers, which turn on after a specific period of inactivity in a single window. Just you wait. Thanks to transparency:
If you like eye-candy, you may "drool" over this one and get your brain fucked by the Illuminati. A frontal lobotomy may be a quicker solution though.
Slashdot hypocrisy (Score:4, Troll)
But when some Windows-weenie slaps together a VB control in five minutes to do the same thing in Win2k, the readers get all bitchy and start complaining about how "useless" it all is. Well, duh. But why didn't you complain about MacOS X's uselessness too?
I object to this story, too, but for a completely different reason: this isn't news. Windows 2000 has always had the ability to display transparent and translucent forms. Windows 2000 can do a whole load of other useless things with forms, too. Ask any Delphi developer -- I can't stand Delphi myself, but a lot of my friends use it -- and he'll show you dynamic desktop magnification and a bunch of other demos that the development suite comes with. It's not news. It may be news to Slashdot's "We only use Windows for games, and Quicktime, and word processing, and financial apps, and graphics work, and email, and web surfing -- but we use Linux for writing Perl scripts, so we're hackers, right?" loser crew, but it's not news to anyone else.
Mirror of the screen shot (Score:3, Informative)
Ho Hum, Already Done (Score:5, Informative)
PowerMenu (Score:3, Informative)
I wrote a small free app called PowerMenu [zdnet.com] which does the same thing and more. It extends every window's system/controlbox menu with new options like always on top and transparency.
Transparency effect... (Score:5, Informative)
SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED); SetLayeredWindowAttributes (hwnd, 0, 180, LWA_ALPHA);
GUI programming in Windows is quite snappy.
Does anyone here get the point? (Score:5, Informative)
Glass and icing (Score:5, Insightful)
There might be a very good reason it's taken two years for the glass-like windowing system. And that would be that it isn't a good idea.
Sure it looks pretty. It's technically cool. It's very nice eyecandy. But useful? Hardly.
If our desktops were three-dimensional, there would be a point - in that case you could refocus on a window below your current. When refocusing, the frontmost window would be so blurry to you that it didn't interfere with your view of what was behind it.
But desktops aren't 3D (and "fake" 3D doesn't work, refocusing requires that your desktop is not displayed on a single plane, as that plane only has one focus), and you can't refocus. What you get is just a blur of all windows that happen to be ontop of one another (and the background if you have a background/wallpaper image).
I would guess that the only time that transparent windows help is if you have an OS/wm that does not offer workspaces or similar. The transparency might help cram an extra three windows onto the screen. Using workspaces you can just put those extra three on another workspace instead.
I have yet to see anybody argue how great it would be if all books were printed on plastic rather than paper, so that we could see through them.
Screensaver (Score:3, Funny)
Its buggy... (Score:3, Informative)
But, I can't find a use for it so far. Maybe if it could make *all* of those 'about' boxes semi-transparent, but there's no way it could know what's an about box and what isn't. Nothing else I tried looks useful in a transparency.
And, it's buggy, or apparently so. After about 10 seconds' thought, I think it's Windows that's buggy. Big surprise there. The Windows console window won't do transparency at all, and sometimes it even draws incorrectly when it's behind a transparent window. It doesn't work with Media Player; in transparency mode, the movie window goes black, and sometimes bringing it out of transparency mode doesn't fix it. Quake3 won't show transparent. Ultima Online flickers badly and slows waaaay down in transparency. Hmmm, DirectX/OpenGL interfering perhaps? Buggy video drivers? So typical.
Wouldn't it be cool if it could make all the menus fade in and out? *rolls eyes*
also HW acc on win2k + Radeon + 3276drv (Score:5, Informative)
Glass windowing on Linux (Score:5, Insightful)
Cute toy (Score:3, Interesting)
It looks like one of those things you install for a couple of minutes for the gee-whiz factor, and then delete. Worthy of a front-page story? Maybe on a slow day -- it is cute -- but:
I've been waiting for this for 2 years now -- a REAL glass-like windowing system. And yes, it's Microsoft to do it.
Seriously, where has 'visnu' been, and why isn't Timothy editing? This maybe a first for MS, but from its inception, Mac OS X has had not just alpha blending, but a completely new compositing system has been a central feature of Mac OS X from inception. And they didn't just slap alpha blending on current windowing, making it harder to use or just to make it do cute my-mouse-has-a-shadow tricks, they integrated it into the usability of the desktop.
Strange to see a /. story claiming MS innovation where there isn't. You'd think it would be the other way around.
Pop-ups (Score:3, Funny)
Really can't complain (Score:3, Informative)
Uses for it? None as of yet. But that probably has to do with the fact that I just became aware of its existence about twenty minutes ago. This is one of those things that I'll keep running in the background and FIND uses for. Some time, maybe a week from now, I'll be working with a program and say "hey, transparency might help me out here," so I'll fire up my little 54K download here and get it running, and BOOM! there it is. Who care's if its not practical yet. Just wait until you need it; then you'll see just how practical it can be. Besides, for 54K what's not to like?
~Forager
Quick after thought: I've already got it running, making my taskbar semi-transparent; I have it set on the left side of my screen, so when it pops up to announce a window update it gets annoying if it's directly over my text or whatever; on 30% opacity, it's much less annoying. Little things like this will make me glad I spent all 20 seconds (56k connection here, people) of my life it took to download this utility.
Alpha Blended Pie Menus and Censorship in The Sims (Score:5, Informative)
The pie menus in The Sims [piemenu.com] use a combination of desaturation, darkening, and alpha blending to feather the edges of the menu.
Why transparency and the other effects? I didn't want the pie menus to obscure too much of the scene behind them. You can see through the pie menu as the animation continues on in real time behind it. The head of the currently selected person is drawn in the center of the pie menu, and follows the cursor by looking at the currently selected item.
I found it necessary to somehow separate the head from the rest of the scene, otherwise it looked like a giant head was floating in a room of the house! Drawing a solid opaque menu background would obscure too much of the scene. But even a partially transparent menu background still did not visually separate the head from the background scene enough. It looked muddy and cluttered, instead of crisp and bright.
So instead of simply alpha blending, I actually made it desaturate the background (removes the color so it's gray scale), and darken it (like casting a colorless shadow).
I wanted the colorful head to look sharp and bright up against the dark gray background. So the effect looks at the Z buffer to clip out the head in the menu center, so it remains bright and colorful against the dark gray background. That gives it visual "pop" that separates the head from the background. The edges of the effect are feathered, so there's no sharp line dividing the inside and the outside of the menu (useless visual clutter).
The gray shadow just gradually tapers off with distance, suggesting that the pie menu active area extends to the edge of the screen, not confined to the borders of a circle. The labels are drawn with high contrast drop shadows around the pie menu, so they stand out and easy to read, partially overlapping the shadow so they're look like they're part of the menu.
There's special code to perform that particular combination of pixel filters in real time, to every frame just after the 3D rendering phase.
The pixelated censorship effect works the same way as the pie menu shadow, like a Photoshop filter run after the 3D rendering phase. There's a special suit type that's tagged as a "censorship" suit. It consists of bounding boxes attached to the varius bones of the skeleton that you can select to censor. So if you just want to censor the head, you attach the head censor suit to the head bone. The 3D character renderer transforms the 8 vertices but doesn't draw anything, and stashes the screen bounding box away for the pixelation filter to draw later. That's how it can censor just the crotch of naked men, but also the chests of naked girls gone wild.
-Don
Varying Translucency w/in Same App (Score:3, Interesting)
So it would be nice to vary the translucency of window text/icons separately from the rest of the window, if desired.
Awesome! Does it support 100% transparency? (Score:3, Funny)