From: Grzegorz Wróbel on
I would like to implement function similar to Windows SetLayeredWindowAttributes() API, but with support for per-pixel transparency (The later supports only one color transparency (c'mon, we live in 21st century, don't we?) and pretty useless constant alpha for all pixels). For this I need to get the pixel information (bitmap) under my Window. What would be the best way to do that?

Note that I don't exactly need what's below my window, I just need this area without my window present (so if my window is obscured by some other window, I can grab that other window as well, It doesn't matter since that part of my window is not visible anyway).

Most naive approach I can think of is to hide my window, Get desktop DC and BitBlt() that area under my window into a bitmap and then restore back my window. Are you familiar with some more reliable ways to achieve that?

TIA,

--
Grzegorz Wr?bel
http://www.4neurons.com/
677265676F727940346E6575726F6E732E636F6D
From: Ron Francis on
Your approach is about all I can think of as well.
The only difference would be to see if I could capture the portion of the
background before the window is displayed.
I'll be interested to see if anyone else has any better ideas.

--

Regards,
Ron Francis
www.RonaldFrancis.com


"Grzegorz Wr?bel" </dev/null(a)localhost.localdomain> wrote in message
news:eg81n9$gjm$1(a)atlantis.news.tpi.pl...
>I would like to implement function similar to Windows
>SetLayeredWindowAttributes() API, but with support for per-pixel
>transparency (The later supports only one color transparency (c'mon, we
>live in 21st century, don't we?) and pretty useless constant alpha for all
>pixels). For this I need to get the pixel information (bitmap) under my
>Window. What would be the best way to do that?
>
> Note that I don't exactly need what's below my window, I just need this
> area without my window present (so if my window is obscured by some other
> window, I can grab that other window as well, It doesn't matter since that
> part of my window is not visible anyway).
>
> Most naive approach I can think of is to hide my window, Get desktop DC
> and BitBlt() that area under my window into a bitmap and then restore back
> my window. Are you familiar with some more reliable ways to achieve that?
>
> TIA,
>
> --
> Grzegorz Wr?bel
> http://www.4neurons.com/
> 677265676F727940346E6575726F6E732E636F6D


From: Grzegorz Wróbel on
Ron Francis wrote:
> Your approach is about all I can think of as well.
> The only difference would be to see if I could capture the portion of the
> background before the window is displayed.
> I'll be interested to see if anyone else has any better ideas.

Actually, since I already use WS_EX_LAYERED style with my window it turns out it is not capturable with GDI, so I don't even have to hide it! I saw complains by others about this feature but for me it's a bless. The only problem would be if I had another WS_EX_LAYERED window beneath my own.

But if I use it with combination with LWA_COLORKEY layered attribute it would be good compromise. This way the system will take care of all fully transparent pixels (fast and 100% reliable) and I will take care only about semitransparent pixels (slower and in case other WS_EX_LAYERED windows are below my own - not reliable). The result will be much better than what Windows has to offer and with the little performance hit, cause I won't need to update my window that often then.

--
Grzegorz Wr?bel
http://www.4neurons.com/
677265676F727940346E6575726F6E732E636F6D
From: Ron Francis on
I haven't played much with layered windows but I do remember reading some
posts about not being able to capture them too.
Very odd behaviour but understandable if that style has to be done outside
of the DC system I guess.
From memory, it was a bit confusing because some functions would capture it
(clipboard maybe?) and others wouldn't.

Anyway, good luck and post back if you get a handle on capturing them.

Regards,
Ron Francis
www.RonaldFrancis.com


"Grzegorz Wr?bel" </dev/null(a)localhost.localdomain> wrote in message
news:eg9j8b$q7g$1(a)nemesis.news.tpi.pl...
> Ron Francis wrote:
>> Your approach is about all I can think of as well.
>> The only difference would be to see if I could capture the portion of the
>> background before the window is displayed.
>> I'll be interested to see if anyone else has any better ideas.
>
> Actually, since I already use WS_EX_LAYERED style with my window it turns
> out it is not capturable with GDI, so I don't even have to hide it! I saw
> complains by others about this feature but for me it's a bless. The only
> problem would be if I had another WS_EX_LAYERED window beneath my own.
>
> But if I use it with combination with LWA_COLORKEY layered attribute it
> would be good compromise. This way the system will take care of all fully
> transparent pixels (fast and 100% reliable) and I will take care only
> about semitransparent pixels (slower and in case other WS_EX_LAYERED
> windows are below my own - not reliable). The result will be much better
> than what Windows has to offer and with the little performance hit, cause
> I won't need to update my window that often then.
>
> --
> Grzegorz Wr?bel
> http://www.4neurons.com/
> 677265676F727940346E6575726F6E732E636F6D


From: Grzegorz Wróbel on
Ron Francis wrote:
> I haven't played much with layered windows but I do remember reading some
> posts about not being able to capture them too.
> Very odd behaviour but understandable if that style has to be done outside
> of the DC system I guess.
> From memory, it was a bit confusing because some functions would capture it
> (clipboard maybe?) and others wouldn't.
Yes, PrtScr captures them into clipboard, but Windows does it on the lower level than GDI, perhaps DirectX.

> Anyway, good luck and post back if you get a handle on capturing them.
That's not a serious concern for me right now, such windows are pretty rare to meet and I think it won't change soon since that style currently is not very useful.

--
Grzegorz Wr?bel
http://www.4neurons.com/
677265676F727940346E6575726F6E732E636F6D