The Windows Presentation Foundation

All the interface changes that come in the Vista package are a direct or indirect result of Vista's new graphical subsystem. Code-named Avalon but now officially called Windows Presentation Foundation (WPF), Vista's graphical underpinnings should prove to be a boon to both developers and end users. But it won't be just the Vista community that benefits from WPF because Microsoft has decided to backport WPF for Windows XP and Windows Server 2003.

Developers will (and, by all accounts, already do) love WPF because it provides a one-stop shop for all their graphical needs. Before WPF, developers had to work with a rather alarming number of technologies and application programming interfaces (APIs). For example, to draw a simple 2D shape, they called on the Graphics Device Interface (GDI); for 3D objects, they used Direct3D or OpenGL; for media objects, they used DirectShow; and for user interface objects, they used USER32 or Windows Forms, to name just a few. Some of these technologies (such as the GDI) have been around since Windows 1.0. Clearly, it was time for a change.

With WPF, developers can do 2D, 3D, animation, imaging, video, audio, special effects, and text rendering using a single API that works consistently no matter what type of object the developer is working with. This greatly simplifies user interface programming, resulting in more robust applications that are delivered to market faster than ever.

WPF also introduced a new markup language called XAMLeXtensible Application Markup Languagewhich acts as a kind of front end for building application interfaces. The idea here is that by using relatively simple markup code, developers and designers can work together to build user interfaces.

From the user's perspective, the main problem has been that although our graphics processing units (GPUs) have been getting ever more powerful, and our video adapters have been populated with more graphics memory, our operating systems and applicationswith the notable exception of the gaming spherehave not been programmed to take advantage of all this powerful hardware.

WPF changes all that by implementing a new graphics model that can take full advantage of today's powerful GPUs and scads of video RAM. With WPF, all output goes through the powerful Direct3D layer, which means that all graphical work is offloaded to the GPU, thus saving the CPU for more important tasks. (Technically, WPF will only pass the graphics load to the GPU in video adapters that support DirectX 7 or later.)

Also, the output uses vector graphics, a rendering technology in which each image on the screen is composed of points, lines, polygons, and curves (these are called primitives). Unlike raster graphics, in which each screen image is composed of pixels, vector graphics support extremely high-resolution images and are completely scalable (that is, you can zoom in and zoom out) without any loss of quality in the image.

Also, WPF implements a new technology called the Desktop Window Manager (DWM), which assumes complete control over what's displayed on the screen. In previous versions of Windows, applications used APIs to display their graphics directly on the screen. Now the DWM takes over that chore. Each application draws its graphics to an off-screen buffer, and then the DWM composites the buffer contents on the screen.

All this means that WPF brings some significant changes to Windows graphics:

  • No more window "tearing" - When you move a window quickly in any GDI-based version of Windows, the edges of the window appear to temporarily "tear" because the system has trouble keeping up with the graphical changes that are happening onscreen. On WDF systems, however, the graphics route through the hardware-accelerated GPU, so window movement remains smooth and seamless no matter how quickly you drag across the screen.
  • Better and more useful animations - Microsoft realized a few years ago that some sort of animation effects were necessary, particularly for novice users. For example, new Windows users are often surprised at the abrupt disappearance of a window when they click the Minimize button. The user either thinks he has closed the program or that he has done something wrong. With an animated minimize, however, the user can "see" the window going down to the toolbar, which offers a vital visual clue about what just happened. With the power of WPF available, Microsoft has implemented animations of much higher quality than those seen in, say, Windows XP. For example, windows that are being moved quickly or minimized have a motion blur effect, which effectively highlights the movement of the window.
  • Improved scaling - With vector-based graphics, you can scale any image bigger or smaller without any loss in the image quality. This is simply not possibly with raster-based graphics. For example, if you have ever tried using larger icons in Windows or a program toolbar, you know that the resulting icons look blurry and jagged. With WPF, everything is drawn with vectors, so you can scale windows and icons as big (or as small) as you want, and the objects will display with no loss in quality.
  • Transparency - Drawing an object so that it offers some level of transparency has always been a tall order for the GDI because transparency effects require hardware acceleration, and the GDI didn't have access to that part of the GPU (for the most part). Any developer trying to get transparency via the GDI would end up with a program that slowed the system to a crawl. With WPF, however, transparency effects are easy because a dedicated GPU is much more capable of rendering them without any effect on overall performance.
  • Video as just another graphical object - Most of us think of video as a real performance killer. Just running video in a single window can slow your system noticeably, and video doesn't move or scale well: If you try, you get dropped frames by the cartload. That all changes in WPF because it treats video as though it were any other graphic object. Thanks to WPF's direct access to the GPU's hardware acceleration, you can move and animate running videos without dropping frames or affecting the performance of the CPU. On a practical level, this enables Vista to show running video when you press Alt+Tab to switch windows and when you move your mouse over the video window's icon in the taskbar.