Using custom effects with pixel shaders
WPF 4 includes two special effect classes, BlurEffect
and DropShadowEffect
. These are built internally using pixel shaders, which are little programs that run on the graphics processing unit (GPU) as one of the final parts of rendering. These shaders originate from DirectX (WPF's lowest level rendering engine), so other effects can be used with the proper setup. Let's take a look at using a custom pixel shader to get special effects, otherwise very difficult or slow to achieve.
Getting ready
To compile shader files, you'll need the DirectX SDK, which can be downloaded from the DirectX portal at http://msdn.microsoft.com/en-US/directx. Click on Get the latest DirectX SDK, download the installer, and install ...
Get Windows Presentation Foundation 4.5 Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.