Welcome to WindowsClient.net | Sign in | Join

Introducing WPF 3.5 SP1 Graphics

by David Teitlebaum

Though only a service pack, the 3.5 SP1 release of Windows Presentation Foundation introduces a number of compelling new graphics features following a few key themes:

  1. Interoperability
  2. Performance
  3. Visual Richness

Interoperability

Interoperability between WPF and other technologies has been given a huge boost with work on two features: D3DImage and WriteableBitmap. D3DImage, introduced in 3.5 SP1 - brings first-class interoperability between Direct3D and WPF. Prior to D3DImage, D3D content could only be consumed by a WPF application via HWND hosting – a solution replete with caveats. D3DImage breaks through the Direct3D-WPF interop barrier by allowing live D3D content to be used in a WPF application as an ImageSource – meaning it can be used anywhere native WPF content can be used.

WriteableBitmap has been substantially improved to allow for much more performant bitmap updates, allowing real-time system-memory bitmap manipulation with very little performance overhead. This unlocks a host of scenarios including directly painting WPF bitmaps with GDI and GDI+.

Performance

On the performance front, WPF has made strides in a number of key areas. Text performance has been substantially improved thanks to a massive refactoring of our text realization infrastructure. This can be seen most visibly when text is used in VisualBrushes and DrawingBrushes.

Performance of the most commonly used BitmapEffects has been dramatically improved in many scenarios thanks to the use of pixel shaders. Both the Blur and DropShadow BitmapEffect classes have been updated to use hardware acceleration when possible, and a new Effect class and derived classes have been created, where built-in effects will reside moving forward.

Visual Richness

Even better, effects now support the use of custom pixel shaders, meaning application authors are free to let their creativity run wild in writing stunning new effects. Extensible ShaderEffects are fully integrated into the platform; they expose their pixel shader constant registers as regular DependencyProperties which can be animated, data bound, and used as any other DPs in WPF.

In the hands of talented artists and developers, the new graphics features in 3.5 SP1 will spur a wave of even richer and more compelling applications. The only question is how you will take advantage of these new capabilities!

David Teitlebaum is a Program Manager for Windows Presentation Foundations Graphics at Microsoft.

Comments: 2

You must Login to comment.
 

maxbr: On December 22, 2008 11:14 AM said:

Hi,

Is there any work in progress or plans to change RenderTargetBitmap so rendering will happen on the GPU instead of the CPU? (= RenderTargetBitmap won't be software rendered)

thnx.

 
 

dteitleb: On January 11, 2010 9:50 PM said:

Nope, no plans to change how RTB works, but in WPF 4.0 we've added a new feature which allows you to cach live subtrees of your application as a cached, hardware-rendered bitmap.  This new feature is called Cached Composition, and is used by setting the new UIElement.CacheMode property to an instance of a BitmapCache.  There are various properties you can tweak on the BitmapCache to allow you to do things such as controlling the fidelity of the bitmap.

David

 

Featured Item