NOTE: The code snippets provided in this page are relative to the member hierarchy in DwmWrapper/GlassLib.
Two of the features introduced in Windows Vista are the Desktop Unified Composition Engine and Desktop Window Manager.
Media Integration Layer is the base of -and a necessity for- both of them and is responsible for making the lower-level tasks, including providing hardware acceleration for graphics, video, effects and animation playback, and maintaining the used Direct3D device. The MIL API, as of yet, is not made public; instead, a higher-level API is available and is known as Windows Presentation Foundation, which is included in .NET Framework 3.0 (currently still in development) and can be used on Windows XP and Windows Server 2003, too.
Both WPF and DWM in Windows Vista take advantage of the UCE to compose graphical output of applications in a back-buffer before presenting it to the screen, unlike GDI+ which writes directly to the screen whenever an area is invalidated. This allows the use of translucency, non-client area rendering and more advanced animations and effects. However, because such a subsystem is supposed to work 24/7, graphics drivers following a new driver model (WDDM) need to be used in order for DWM to operate in Windows Vista.
The DWM holds a Visual Tree of references to all raw windows whose output and processing is handled by the underlying API, USER. However, the composition of these windows, including animations is handled by the DWM. Each window, whether it is a top-level one or not, has an appropriate node in the aforementioned UI Tree.
Window data presented to the screen is a bitmap texture, and because MIL features an advanced Imaging API allowing the reuse of textures inside the context (being DWM in the case) provides the so-called Thumbnails part of the DWM API. It provides the ability to create references to certain windows and use their real-time preview in other windows or controls. For instance, this is utilized in the Taskbar Thumbnails feature in Windows Vista. Redirection of the actual window surfaces is also possible, and used internally by Flip3D.
In Windows Vista, rendering windows’ non-client area is handled by the DWM itself. This includes painting the window frames, background, title bar and control box. In addition to this, gaussian blur, as a per-pixel shader, is applied to the visible windows in this region. This is done for readability purposes and so that users can focus on the current window without being distracted by other visual elements. For performance precautions, it is possible to change the non-client area rendering policy to use the Windows Vista Basic visual style instead:
Dwm.NonClientRendering[myWindow].Enabled = false;
Enabling Blur in a given regular window manually might lead to unexpected results, such as controls being painted incorrectly. This is because this API function is to be used on layered windows and such without any borders, for which blur is not applied by default. It is recommended that only rectangular regions are used to define blurred areas. A null region is treated by the DWM as the area of the whole window.
Dwm.Blur[myWindow].Enabled = true;Dwm.Blur[myWindow].Region = new DwmRect(0, 0, 100, 30);
A better way to define a specific blurred area of a window is to extend Glass into its client area.
Search
About |
Currently, he is administering AeroXperience and coding using Visual Studio 2008 on Windows Vista. He is looking forward to testing Windows 7 soon.