Hardware accelerated DeepZoom in Silverlight 4

johnWeeGo[1]The MultiScaleImage control in Silverlight 4 can now optionally be hardware accelerated. This means those massive images or, in my case, maps of the world can be smoothly rendered by using your compatible video card to do the heavy lifting. So what difference does it make? Let’s take a look, my example went from 40-80% cpu usage to 5-10%!

HWPerfDifference

Take a spin of the hardware accelerated version here. Mouse wheel to zoom. If you right click you can even install out of browser.

What steps do we have to take to make this happen? First we have to enable the cachemode on the MSI control itself:


<MultiScaleImage x:Name="msi" CacheMode="BitmapCache" />

Then for the browser app we add a param to the plugin:


<param name="EnableGPUAcceleration" value="true" />

For “Out-Of-Browser” it is in the advanced options in the silverlight project:

OOBHW 

Download the full source here.