Current version

v1.10.4 (stable)

Navigation

Main page
Archived news
Downloads
Documentation
   Capture
   Compiling
   Processing
   Crashes
Features
Filters
Plugin SDK
Knowledge base
Donate
Contact info
Forum
 
Other projects
   Altirra

Search

Archives

01 Dec - 31 Dec 2013
01 Oct - 31 Oct 2013
01 Aug - 31 Aug 2013
01 May - 31 May 2013
01 Mar - 31 Mar 2013
01 Feb - 29 Feb 2013
01 Dec - 31 Dec 2012
01 Nov - 30 Nov 2012
01 Oct - 31 Oct 2012
01 Sep - 30 Sep 2012
01 Aug - 31 Aug 2012
01 June - 30 June 2012
01 May - 31 May 2012
01 Apr - 30 Apr 2012
01 Dec - 31 Dec 2011
01 Nov - 30 Nov 2011
01 Oct - 31 Oct 2011
01 Sep - 30 Sep 2011
01 Aug - 31 Aug 2011
01 Jul - 31 Jul 2011
01 June - 30 June 2011
01 May - 31 May 2011
01 Apr - 30 Apr 2011
01 Mar - 31 Mar 2011
01 Feb - 29 Feb 2011
01 Jan - 31 Jan 2011
01 Dec - 31 Dec 2010
01 Nov - 30 Nov 2010
01 Oct - 31 Oct 2010
01 Sep - 30 Sep 2010
01 Aug - 31 Aug 2010
01 Jul - 31 Jul 2010
01 June - 30 June 2010
01 May - 31 May 2010
01 Apr - 30 Apr 2010
01 Mar - 31 Mar 2010
01 Feb - 29 Feb 2010
01 Jan - 31 Jan 2010
01 Dec - 31 Dec 2009
01 Nov - 30 Nov 2009
01 Oct - 31 Oct 2009
01 Sep - 30 Sep 2009
01 Aug - 31 Aug 2009
01 Jul - 31 Jul 2009
01 June - 30 June 2009
01 May - 31 May 2009
01 Apr - 30 Apr 2009
01 Mar - 31 Mar 2009
01 Feb - 29 Feb 2009
01 Jan - 31 Jan 2009
01 Dec - 31 Dec 2008
01 Nov - 30 Nov 2008
01 Oct - 31 Oct 2008
01 Sep - 30 Sep 2008
01 Aug - 31 Aug 2008
01 Jul - 31 Jul 2008
01 June - 30 June 2008
01 May - 31 May 2008
01 Apr - 30 Apr 2008
01 Mar - 31 Mar 2008
01 Feb - 29 Feb 2008
01 Jan - 31 Jan 2008
01 Dec - 31 Dec 2007
01 Nov - 30 Nov 2007
01 Oct - 31 Oct 2007
01 Sep - 30 Sep 2007
01 Aug - 31 Aug 2007
01 Jul - 31 Jul 2007
01 June - 30 June 2007
01 May - 31 May 2007
01 Apr - 30 Apr 2007
01 Mar - 31 Mar 2007
01 Feb - 29 Feb 2007
01 Jan - 31 Jan 2007
01 Dec - 31 Dec 2006
01 Nov - 30 Nov 2006
01 Oct - 31 Oct 2006
01 Sep - 30 Sep 2006
01 Aug - 31 Aug 2006
01 Jul - 31 Jul 2006
01 June - 30 June 2006
01 May - 31 May 2006
01 Apr - 30 Apr 2006
01 Mar - 31 Mar 2006
01 Feb - 29 Feb 2006
01 Jan - 31 Jan 2006
01 Dec - 31 Dec 2005
01 Nov - 30 Nov 2005
01 Oct - 31 Oct 2005
01 Sep - 30 Sep 2005
01 Aug - 31 Aug 2005
01 Jul - 31 Jul 2005
01 June - 30 June 2005
01 May - 31 May 2005
01 Apr - 30 Apr 2005
01 Mar - 31 Mar 2005
01 Feb - 29 Feb 2005
01 Jan - 31 Jan 2005
01 Dec - 31 Dec 2004
01 Nov - 30 Nov 2004
01 Oct - 31 Oct 2004
01 Sep - 30 Sep 2004
01 Aug - 31 Aug 2004

Stuff

Powered by Pivot  
XML: RSS feed 
XML: Atom feed 

§ Abusing a composited desktop

Here's a stupid Windows trick to abuse the Desktop Window Manager.

Basically, the idea is to try to get a translucent window that doesn't have a hit testing area, i.e. it's invisible to the mouse. This creates an overlay on screen that displays something but doesn't occupy space on screen. Traditionally, support in Windows hasn't been very good for this, because the only way to get translucency was to use a layered window -- which interacted very badly with Direct3D rendering in XP -- and because WS_EX_TRANSPARENT worked poorly or not at all across threads. In Windows 7 with the DWM, however:

translucent video player

...you get a translucent no-hit window that actually works. No more having to fish the VS2005's Find and Replace window out from under the video player.

There isn't an easy way to do this without code, but if you're curious, here's a tiny command line program to toggle this on a running instance Media Player Classic - Home Cinema: transplayer.zip. I haven't tried it with the original MPC but it might work if the window class is the same. Again, you need at least Windows Vista for this, as it's highly likely not to work at all on XP. Also, you may have to turn off VSync tracking on the renderer as I think that reacted badly once the window became layered.

I haven't done any real testing on this, and if you rely on it in production software you'll probably get lampooned on The Old New Thing about five years from now, but it's neat when it works.

Comments

Comments posted:


Nice idea! I solved this problem by moving the video to my second monitor.

tobi - 24 04 11 - 21:51


Isn't the classic (and basic) theme still rendered without the DWM? If so, don't you have the sme rendering architecture there as always, except maybe for Vista-related changes? But I guess the DWM is not involved at all unless you're using Aero.

Joey - 24 04 11 - 21:59


No second monitor on a laptop.

It might be incorrect to say that the DWM is involved here, since at least composition is not required -- this works even if Aero is disabled. The rendering architecture is substantially different than XP due to the WDDM driver model, though. A lot of the badness associated with Direct3D not behaving with layered windows and second monitors on XP was associated with the mismatch between the 2D and 3D rendering paths being different -- specifically, cases where GDI would try to do a software rendering operation and the driver might or might not try to hack around it to avoid the stall. With WDDM, however, everything is going through the 3D driver and so things run a lot more smoothly.

The one downer about this is that the API doesn't give you control over the blending mode, as I would have preferred a color multiply instead of a constant lerp. The only other blending mode that you can do this way that I know of is an add, by extending the blur into the client area and then putting an alpha channel on your Direct3D backbuffer of constant 0. I wonder if there's a way to do this through the undocumented MIL APIs.

Phaeron - 24 04 11 - 22:19


There has been a program around for ages called Glass2k. I had limited success with it on XP, but works rather well on Windows 7.

It basically allows you to set a windows transparency on a per-application basis - and remembers it so when you close and re-open the app again, the transparency is automatically re-applied. It also has keyboard short-cuts to set transparency on the current focused window. Oh, and its freeware.

I didn't write and I don't have any direct association with the author - it's just one of the useful utilities that I now use constantly.

MarC - 25 04 11 - 09:59


That's awesome! (Tried on the old normal MPC version I use 6.4.9 - and works just fine on Win7).

Nic - 02 05 11 - 08:03


http://support.microsoft.com/kb/937106/e.. "Performance is poor in a WPF-based application in which you have enabled layered windows in Windows XP or in Windows Server 2003" states that: "In DirectX 9.0c, the IDirect3DSurface9::GetDC method does not support transparency effects that use an alpha channel. Therefore, graphics that a WPF-based application renders are not hardware-accelerated. Instead, the application renders graphics at the software level. In this situation, the application performs poorly and uses a high proportion of CPU time."

I'm not a graphics programmer, but doesnt this sound related? Is it simply the fact that XP transparency is never hardware accelerated? Although, with Winamp 2.9x and MilkDrop or AVS visualizations, you can "Enable overlay" and it does show the visualization at high framerate all over the screen, but that's not really the same as transparency..

Syclone0044 (link) - 22 06 11 - 16:40


Transparency can and often is accelerated on XP -- the video driver can accelerate AlphaBlend(). The problem is that Direct3D9 doesn't really integrate with GDI rendering, so when you mix layered windows with D3D rendering, the D3D present bypasses the layered compositing and the two fight over the display.

The hotfix you linked to is interesting. As far as I've known, GetDC() was always a bad idea on any DirectX surface as it gave you GDI software rendering. This hotfix applies to the user-space D3D9 DLL, though, and I wonder if they changed that

The overlay transparency you are referring to is different. It's much the same idea, but it's a separate hardware plane instead of software compositing. They also can't alpha blend, as the transparency is only by colorkeying (cutout). Hardware overlays are powerful, but have such a tremendous number of bugs in both Windows and the video drivers that I've stopped using them by default.

Phaeron - 22 06 11 - 17:49

Comment form


Please keep comments on-topic for this entry. If you have unrelated comments about VirtualDub, the forum is a better place to post them.
Name:  
Remember personal info?

Email (Optional):
Your email address is only revealed to the blog owner and is not shown to the public.
URL (Optional):
Comment: /

An authentication dialog may appear when you click Post Comment. Simply type in "post" as the user and "now" as the password. I have had to do this to stop automated comment spam.



Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.