I’ve been working on a Silverlight 1.0 sample that I’d like to share with you for two reasons:
- I think it’s a great application of the VideoBrush feature in Silverlight which enables you to route video to any shape’s stroke or fill.
- I need a little bit of help with the math to get the zooming right.
The sample which you can see here is a magnifying glass that zooms in on whatever portion of a playing video that it’s over. This effect is done through using the VideoBrush in Silverlight 1.0. Typically you would hide the source MediaElement for the VideoBrush, but in this case I wanted to show both. By doing that I keep the two videos in synch.
I plan on submitting this sample to the gallery on Silverlight.net but I need to get some of the math right when you zoom in/out the magnifier. You will notice that the center is not correct once you rotate the zoom lever.
What are the applications of this technique:
- Add a magnifier to any Silverlight application that uses video
- Change the brush shape from a circle to a binocular shape.
- Hunting game
On Friday February 15, 2008 at 10:00 PDT, I will be hosting a free webinar where I will explain how I built this demo. Register here. It will be recorded if you cannot make the live event.
I have attached the source code to this Post (without the Bear.wmv video – it comes with Windows Vista in the Sample Videos folder).
Some Math Help Please
If you like this demo, and are good at math, I need your help. If you rotate the zoom handle you will notice that the magnified video gets offset incorrectly. I would love any help the Silverlight community would like to offer to help me with my math to get it right.