News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Alphatransparent window borders

Started by stanhebben, September 06, 2006, 10:27:28 AM

Previous topic - Next topic

stanhebben

I'm currently making a skinnable GUI, which supports full alphatransparency. Everything is owner-drawn, including title bar, buttons, ...

The alphatransparency is handled by keeping an internal buffer and alpha blending everything to get the alphatransparency. But I'd like to make the window border alphatransparent too.

I could simulate it by filling my buffer with background data, but how can that be done? Or does anyone know an alternative? I found a function GetPixel, but I could als well be reading my own data.

ninjarider

i dont have my vb stuff here so you cant qoute me. theres an api function to get the dc, getdc. i cant remember the name of it but theres also an api function to get the window handle, and i cant remember the name get something. but you use the get handle function with the perameter 0. then you use the getdc with the value from the get handle function. the use getpixel to get your data to blend. thats about all i can think of the moment man, and about the easiest.

P1

Who says you need a border ?

Regards,  P1  :8)

MickD

Are you using Windows or Linux?
If so, perhaps you can grab a screen dump of the desktop as a bit map, trim it to your border size and blend it in with your graphics api. This would take a bit of work though for when you move your window to grab the pixels each time. I guess if your window has focus you could use the whole desktop and store it for future calc's discarding the unused pixels before you draw you window(?)
If you are using your own desktop gui you should be able to blend it naturally using the z buffer to calc your alpha values.

A cool feature I've seen in a linux distro which I think uses a similar idea (a screen dump) to create a bitmap and map it to a polygon which can be revolved around in 3d space with other widows, very cool.(at least that is how I'd have a go at it).

hth,
Mick.

stanhebben

I could use GetPixel, but then I'll have to get the windows below me repaint that area. I've been trying to use InvalidateRect with a NULL window handle, but that doesn't work.

ninjarider

i know in vb there was a way to tell if your program had just been received focus. or atleast that is the way it is phrased in vb. you could wait for that to come from windows to redraw your border.