Silverlight 3.0 beta1 was released today. One of the new cool features is the pixel shader support, allowing you to make some really cool effects. I managed to fairly quickly convert the WPF Pixel Shader library to a Silverlight library (except a couple of effects), and successfully apply them to any UIElement.
To save you the trouble, you can grab the source for the library from here: ShaderEffectLibrary.zip (44.65 kb)
To use it, simply import the assembly namespace:
xmlns:fx=”clr-namespace:ShaderEffectLibrary;ShaderEffectLibrary"
and then apply any effect to your elements by setting the Effect property:
<Grid>
<Grid.Effect>
<fx:RippleEffect />
</Grid.Effect>
</Grid>
The supported effects are: BandedSwirl, Bloom, BrightExtract, ColorKeyAlpha, ColorTone, ContrastAdjust, DirectionalBlur, Embossed, Gloom, GrowablePoissonDiskEffect, InvertColor, LightStreak, Magnify, Monochrome, Pinch, Pixelate, Ripple, Sharpen, SmoothMagnify, Swirl, Tone, Toon, and ZoomBlu.
Note that you will need to have the Silverlight 3.0 bits installed to use this.
UPDATE: The WPF Pixel Shader library has now added support for Silverlight as well: http://wpffx.codeplex.com/
Also note that if you want to take advantage of the new GPU hardware acceleration to further enhance performance, this is an opt-in feature! To get it, you have to go to the hosting html page and set the following object parameter (update: This doesn't apply to pixel shaders which are software only):
<param name=”enableGPUAcceleration” value=”true” />
Also note that pixel shaders are software only, and if you add a shader to your hardware accelerated element, it will switch back to software.