Back to Home

WPF rendering engine.

December 29, 20114 minutes read
WPF rendering engine.

WPF Rendering Engine
Windows Presentation Foundation (WPF) is graphical display system for Windows Operating System. WPF hit the Windows users and Market, because of its high level Graphical rendering when compared to primitive graphical applications. Before .Net 3.0 it is not possible to create rich graphical Windows applications, since Windows Forms and MFC were in the way.
The main difference I can point out between Windows Forms and WPF is the way they used to render the User Interface.
·         Windows Forms completely depends on GDI/GDI+ (sometimes User32) for UI rendering.
·         Whereas WPF depends on DirectX for its UI rendering.
DirectX is an older error prone gaming tool, which is used to render rich shapes, textures, gradients, etc.
Shortly after Windows 95, DirectX has matured and it supports most of the advanced Video Cards. But still most of the DirectX programming API reflect its root to older game developer’s toolkit.
Hardware Acceleration
Hardware acceleration is the use of computer hardware to perform some function faster than is possible in software running on the general-purpose CPU. Having a high powered video card is not a guarantee, that it will provide high level hardware acceleration. Software should also play a significant role.
WPF offers some sort of hardware acceleration to all WDDM (Windows Display Driver Model) and XPDM (Windows XP Driver Model) drivers. But the level of offering the acceleration differs. It assigns its rating in hardware acceleration from 0 to 2.
·         Rendering Tier 0: The Video card will not provide any hardware acceleration. Corresponds to DirectX version less than 7.0.
·         Rendering Tier 1: The Video card will provide partial hardware acceleration. Corresponds to DirectX version between 7.0 and 9.0.
·         Rendering Tier 2: The Video card will provide complete hardware acceleration. Corresponds to DirectX version greater than 9.0.
What is a pixel?
A WPF Window and all its elements inside it are measure using device independent units. A single device independent unit is equal to 1/96 of an inch.
For example, if we create a WPF button with 1 inch(i.e. 96 by 96 units ) in size. And if we are using the standard Windows DPI (Dots per inch) settings (96 DPI), each device independent unit is equal to one real, physical pixel.
[Physical Unit Size] = [Device independent unit size] * [System DPI]
                                      =1/96 inch * 96 dpi
                                      =1 pixel
Note : WPF respond only to System DPI settings and not to the System resolutions as Windows Forms or other application does.