<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>You had me at "Hello World!" : Image</title><link>http://blogs.msdn.com/nikola/archive/tags/Image/default.aspx</link><description>Tags: Image</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Nice background image</title><link>http://blogs.msdn.com/nikola/archive/2009/08/13/nice-background-image.aspx</link><pubDate>Thu, 13 Aug 2009 11:23:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9867851</guid><dc:creator>nikola</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/nikola/comments/9867851.aspx</comments><wfw:commentRss>http://blogs.msdn.com/nikola/commentrss.aspx?PostID=9867851</wfw:commentRss><description>&lt;P&gt;My latest creation last night... space view of a planet on a starry background&lt;/P&gt;
&lt;P&gt;The image is 1920x1440&lt;/P&gt;
&lt;P&gt;Hope you like it :) Feel free to use it as your desktop background, if you like :)&lt;/P&gt;
&lt;P&gt;&lt;IMG style="WIDTH: 1034px; HEIGHT: 783px" title=planet alt=planet src="http://blogs.msdn.com/nikola/attachment/9867851.ashx" width=1920 height=1440 mce_src="http://blogs.msdn.com/nikola/attachment/9867851.ashx"&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9867851" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/nikola/attachment/9867851.ashx" length="253311" type="image/jpeg" /><category domain="http://blogs.msdn.com/nikola/archive/tags/Image/default.aspx">Image</category></item><item><title>Silverlight: Super-fast Dymanic Image Generation Code (Revisited)</title><link>http://blogs.msdn.com/nikola/archive/2009/03/04/silverlight-super-fast-dymanic-image-generation-code-revisited.aspx</link><pubDate>Thu, 05 Mar 2009 04:33:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9459195</guid><dc:creator>nikola</dc:creator><slash:comments>11</slash:comments><comments>http://blogs.msdn.com/nikola/comments/9459195.aspx</comments><wfw:commentRss>http://blogs.msdn.com/nikola/commentrss.aspx?PostID=9459195</wfw:commentRss><description>&lt;P&gt;I decided to give a third spin of Joe Stegman's dynamic image generation code. This time, it's many times faster (about 10x) than the original implementation and the png is generated in-place (no recoding necessary).&lt;/P&gt;
&lt;P&gt;I used some hacky optimizations :) For example, replacing the big CRC loop with a constant (0), definitely improves speed a lot! :)&lt;/P&gt;
&lt;P&gt;There are no more intermediate memory streams or buffers: whenever SetPixel() is called, the value is written directly into PNG. Also all the header and size information is created just once. That also helped performance quite a bit.&lt;/P&gt;
&lt;P&gt;With the new code my raindrops sample runs 20% faster (90% of the time used in calculating the drops): &lt;A href="http://www.nokola.com/raindrops" mce_href="http://www.nokola.com/raindrops"&gt;www.nokola.com/raindrops&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Download the source code containing the new PngEncoder class here: &lt;A href="http://www.nokola.com/sources/water.zip" mce_href="http://www.nokola.com/sources/water.zip"&gt;www.nokola.com/sources/water.zip&lt;/A&gt; &lt;/P&gt;
&lt;P mce_keep="true"&gt;Here's how to use the new image generator class:&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;PngEncoder&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; surface = &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;new&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;PngEncoder&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;(640, 480); &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;// image dimension&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;surface.SetPixelSlow(40, 30, 200, 135, 32, 255); &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;// set pixel at (40,30) with color RGBA=(200,135,32,255)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;// draw a white horizontal line fast&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; rowStart = surface.GetRowStart(30);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;for&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; (&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; i = 0; i &amp;lt; 10; i++) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;// SetPixelAtRowStart() is good for blitting/copying existing images onto this one&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: 0.5in; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;surface.SetPixelAtRowStart(i + 40, rowStart, 255, 255, 255, 255); &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;o:p&gt;&lt;FONT color=#595959 size=3 face=Calibri&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;// display the image&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;BitmapImage&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; img = &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;new&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;BitmapImage&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;img.SetSource(surface.GetImageStream());&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;imgWater.Source = img; &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;// this is just a normal Silverlight Image&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;And, here's the GetImageStream() function for comparison with the previous implementation:&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;Stream&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; GetImageStream()&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: 0.5in; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;MemoryStream&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; ms = &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;new&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;MemoryStream&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: 0.5in; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;ms.Write(_buffer, 0, _buffer.Length);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: 0.5in; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;ms.Seek(0, &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;SeekOrigin&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;.Begin);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: 0.5in; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;return&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; ms;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;Compare this to the previous function, that had numerous for()-s, encoding logic, etc :)&lt;/P&gt;
&lt;P mce_keep="true"&gt;hoho! I'm very happy for doing this!&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;STRONG&gt;Edit:&lt;/STRONG&gt; here's the source code for the SetPixelXX functions - to prove they are actually not slow :)&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;void&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; SetPixelSlow(&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; col, &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; row, &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;byte&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; red, &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;byte&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; green, &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;byte&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; blue, &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;byte&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; alpha)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: 0.5in; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; start = _rowLength * row + col * 4 + 1;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; blockNum = start / _blockSize;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;start += ((blockNum + 1) * 5);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;start += _dataStart;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;_buffer[start] = red;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;_buffer[start + 1] = green;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;_buffer[start + 2] = blue;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;_buffer[start + 3] = alpha;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;void&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; SetPixelAtRowStart(&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; col, &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; rowStart, &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;byte&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; red, &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;byte&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; green, &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;byte&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; blue, &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;byte&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; alpha)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: 0.5in; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; start = rowStart + (col &amp;lt;&amp;lt; 2);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;_buffer[start] = red;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;_buffer[start + 1] = green;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;_buffer[start + 2] = blue;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;_buffer[start + 3] = alpha;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; GetRowStart(&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; row)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: 0.5in; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; start = _rowLength * row + 1;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; blockNum = start / _blockSize;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;start += ((blockNum + 1) * 5);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;start += _dataStart;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;return&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt; start;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; COLOR: windowtext; FONT-SIZE: 10pt; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-no-proof: yes; mso-fareast-theme-font: minor-latin"&gt;}&lt;/SPAN&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9459195" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/nikola/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://blogs.msdn.com/nikola/archive/tags/Image/default.aspx">Image</category></item><item><title>Optimized Joe Stegman's Dynamic Image Generation (Twice the Speed)</title><link>http://blogs.msdn.com/nikola/archive/2008/07/04/optimized-joe-stegman-s-dynamic-image-generation-twice-the-speed.aspx</link><pubDate>Fri, 04 Jul 2008 20:19:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8690157</guid><dc:creator>nikola</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/nikola/comments/8690157.aspx</comments><wfw:commentRss>http://blogs.msdn.com/nikola/commentrss.aspx?PostID=8690157</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Verdana','sans-serif'"&gt;I needed a &lt;B&gt;good and relatively fast dynamic image generation code for Silverlight&lt;/B&gt; (for the next sample, you’ll see).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Verdana','sans-serif'"&gt;Joe Stegman has an excellent post including source code for generating images in Silverlight: &lt;A href="http://blogs.msdn.com/jstegman/archive/2008/04/21/dynamic-image-generation-in-silverlight.aspx" mce_href="http://blogs.msdn.com/jstegman/archive/2008/04/21/dynamic-image-generation-in-silverlight.aspx"&gt;http://blogs.msdn.com/jstegman/archive/2008/04/21/dynamic-image-generation-in-silverlight.aspx&lt;/A&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Verdana','sans-serif'"&gt;Joe’s code is simple and easy to understand, but can be optimized for speed quite a bit.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Verdana','sans-serif'"&gt;After doing some profiling (looking in Task Manager) and optimizations, I managed to speed up the code more than twice. To find out the slowest functions, I just ran and image generation in a loop and looked at the CPU usage in Task Manager when disabling each of the functions.&lt;/SPAN&gt;&lt;/P&gt;
&lt;H2 style="MARGIN: 10pt 0in 0pt"&gt;&lt;FONT face=Cambria color=#4f81bd size=4&gt;These are the things I updated:&lt;/FONT&gt;&lt;/H2&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: Symbol"&gt;&lt;SPAN&gt;·&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Verdana','sans-serif'"&gt;All the image data is not copied anymore in the WriteChunk() function&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: Symbol"&gt;&lt;SPAN&gt;·&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Verdana','sans-serif'"&gt;One big array was initialized on every frame in Encode()&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: Symbol"&gt;&lt;SPAN&gt;·&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Verdana','sans-serif'"&gt;Changed SetPixel() to remove some checks in Release mode&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: Symbol"&gt;&lt;SPAN&gt;·&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Verdana','sans-serif'"&gt;The Adler32 algorithm was amazingly slow (it’s doing two prime number divisions for each pixel)…after looking at Wikipedia I found a trick that makes the adler use 5550 times less divisions &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: Wingdings"&gt;&lt;SPAN&gt;J&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Verdana','sans-serif'"&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Verdana','sans-serif'"&gt;The optimized source is here: &lt;A href="http://blogs.msdn.com/nikola/attachment/8690157.ashx"&gt;http://blogs.msdn.com/nikola/attachment/8690157.ashx&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;H2 style="MARGIN: 10pt 0in 0pt"&gt;&lt;FONT face=Cambria color=#4f81bd size=4&gt;Further optimizations&lt;/FONT&gt;&lt;/H2&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Verdana','sans-serif'"&gt;There can be more optimizations, for example the PngEncoder always works with the same image width/height, so it may avoid some calls to write to a memory stream and bulk several calls into one.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Verdana','sans-serif'"&gt;The second memory stream in Encode() can be removed.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Verdana','sans-serif'"&gt;Maybe the image can be stored png-encoded and just updated by SetPixel. This way the stream creation will be very fast. This will be good if for example only 10% of the pixels are changed each frame.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Verdana','sans-serif'"&gt;I hope someone else will pick up the source finish what we started &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: Wingdings"&gt;&lt;SPAN&gt;J&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Verdana','sans-serif'"&gt; (or I’ll finish it later)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Note: this is a remake of a post that was accidentally deleted.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8690157" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/nikola/attachment/8690157.ashx" length="3887" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/nikola/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://blogs.msdn.com/nikola/archive/tags/Image/default.aspx">Image</category><category domain="http://blogs.msdn.com/nikola/archive/tags/Sample/default.aspx">Sample</category><category domain="http://blogs.msdn.com/nikola/archive/tags/Source+Code/default.aspx">Source Code</category></item><item><title>Building 1977 Computer Emulator in Silverlight</title><link>http://blogs.msdn.com/nikola/archive/2008/05/21/building-1977-computer-emulator-in-silverlight.aspx</link><pubDate>Wed, 21 May 2008 18:39:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8528473</guid><dc:creator>nikola</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/nikola/comments/8528473.aspx</comments><wfw:commentRss>http://blogs.msdn.com/nikola/commentrss.aspx?PostID=8528473</wfw:commentRss><description>&lt;H2 style="MARGIN: 10pt 0in 0pt"&gt;&lt;FONT face=Cambria color=#4f81bd size=4&gt;In This Sample&lt;/FONT&gt;&lt;/H2&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;How to build a 1977 PC emulator with Silverlight&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Dynamic image generation&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;25 Games&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;If you like this sample, please vote for it on the &lt;/FONT&gt;&lt;A href="http://silverlight.net/community/gallerydetail.aspx?cat=5&amp;amp;sort=2" mce_href="http://silverlight.net/community/gallerydetail.aspx?cat=5&amp;amp;sort=2"&gt;&lt;FONT face=Calibri color=#800080 size=3&gt;Silverlight.net Community Gallery&lt;/FONT&gt;&lt;/A&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;IFRAME style="WIDTH: 820px; HEIGHT: 560px" src="http://silverlight.services.live.com/invoke/61093/ChipGr8/iframe.html" frameBorder=0 scrolling=no&gt;&lt;/IFRAME&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;H2 style="MARGIN: 10pt 0in 0pt"&gt;&lt;FONT face=Cambria color=#4f81bd size=4&gt;More Information&lt;/FONT&gt;&lt;/H2&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Last Sunday I decided to try and build an x86 (namely the 8086) emulator in Silverlight to play the Digger game. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri size=3&gt;This turned out to be a more time-consuming job than I expected. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Luckily, one of the first gaming platforms (Chip8/SChip) is relatively very easy to emulate.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Few hours later I had a working prototype already! This is a very good starter for people like me and definitely very exciting!.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Also there are a lot of classics for it – Tetrises, Pacmans, Racing, Pong, even Pipe Dream.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Chip architecture, screen and keyboard: &lt;/FONT&gt;&lt;A href="http://www.pdc.kth.se/~lfo/chip8/CHIP8.htm" mce_href="http://www.pdc.kth.se/~lfo/chip8/CHIP8.htm"&gt;&lt;FONT face=Calibri color=#800080 size=3&gt;David Winter's Chip8 Emulator Web Site&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Source code for the above sample: &lt;/FONT&gt;&lt;A href="http://www.nokola.com/sources/ChipGr8.zip" mce_href="http://www.nokola.com/sources/ChipGr8.zip"&gt;&lt;FONT face=Calibri size=3&gt;Download ChipGr8 Source Code&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;A href="http://silverlight.net/community/gallerydetail.aspx?cat=5&amp;amp;sort=2" mce_href="http://silverlight.net/community/gallerydetail.aspx?cat=5&amp;amp;sort=2"&gt;&lt;FONT face=Calibri color=#800080 size=3&gt;&lt;/FONT&gt;&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8528473" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/nikola/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://blogs.msdn.com/nikola/archive/tags/Image/default.aspx">Image</category><category domain="http://blogs.msdn.com/nikola/archive/tags/Sample/default.aspx">Sample</category><category domain="http://blogs.msdn.com/nikola/archive/tags/PC+Emulator/default.aspx">PC Emulator</category></item><item><title>Image Effects with Silverlight: Creating the Saturation Light Sample</title><link>http://blogs.msdn.com/nikola/archive/2008/04/23/image-effects-with-silverlight-creating-the-saturation-light-sample.aspx</link><pubDate>Thu, 24 Apr 2008 02:27:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8420193</guid><dc:creator>nikola</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/nikola/comments/8420193.aspx</comments><wfw:commentRss>http://blogs.msdn.com/nikola/commentrss.aspx?PostID=8420193</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;This sample demonstrates the following:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo2"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;1.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Simulating any image effect with Silverlight&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo2"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;2.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Using the mouse wheel in a Silverlight application&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"&gt;&lt;A href="http://www.nokola.com/SaturationLight.aspx" mce_href="http://www.nokola.com/SaturationLight.aspx"&gt;&lt;SPAN style="FONT-SIZE: 12pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'; TEXT-DECORATION: none; mso-no-proof: yes; mso-fareast-font-family: 'Times New Roman'; text-underline: none"&gt;&lt;?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /&gt;&lt;v:shapetype id=_x0000_t75 coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"&gt;&lt;v:stroke joinstyle="miter"&gt;&lt;/v:stroke&gt;&lt;v:formulas&gt;&lt;v:f eqn="if lineDrawn pixelLineWidth 0"&gt;&lt;/v:f&gt;&lt;v:f eqn="sum @0 1 0"&gt;&lt;/v:f&gt;&lt;v:f eqn="sum 0 0 @1"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @2 1 2"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @3 21600 pixelWidth"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @3 21600 pixelHeight"&gt;&lt;/v:f&gt;&lt;v:f eqn="sum @0 0 1"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @6 1 2"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @7 21600 pixelWidth"&gt;&lt;/v:f&gt;&lt;v:f eqn="sum @8 21600 0"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @7 21600 pixelHeight"&gt;&lt;/v:f&gt;&lt;v:f eqn="sum @10 21600 0"&gt;&lt;/v:f&gt;&lt;/v:formulas&gt;&lt;v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"&gt;&lt;/v:path&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:lock v:ext="edit" aspectratio="t"&gt;&lt;/o:lock&gt;&lt;/v:shapetype&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&lt;A class=image id=ctl00_ContentPlaceHolder1_HyperLink2 href="http://www.nokola.com/SaturationLight.aspx" mce_href="http://www.nokola.com/SaturationLight.aspx"&gt;&lt;IMG class=noborder alt=Sample src="http://www.nokola.com/images/thumb_satlight.jpg" mce_src="http://www.nokola.com/images/thumb_satlight.jpg"&gt;&lt;/A&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;Download sample source code:&lt;/B&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;A href="http://www.nokola.com/sources/SaturationLight.zip" mce_href="http://www.nokola.com/sources/SaturationLight.zip"&gt;&lt;FONT face=Calibri size=3&gt;http://www.nokola.com/sources/SaturationLight.zip&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;The main XAML consists of 2 images:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;1.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Saturated image&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;2.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Desaturated image&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;To create the visual effect of a “light” I added an opacity mask to the saturated image and set it to this radial gradient brush:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Image.OpacityMask&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;RadialGradientBrush&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; RadiusX&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="0.46"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; RadiusY&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="0.64"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; GradientOrigin&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="0,0"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Center&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="0,0"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; x&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Name&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="brushLight"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Opacity&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="0"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;GradientStop&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Offset&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="0"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Color&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="#FF000000"/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;GradientStop&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Offset&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="1"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Color&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="#00000000"/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;RadialGradientBrush&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Image.OpacityMask&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;The GradientOrigin and Center control where the “light” is situated on the image. When we move the mouse on the image we change the light position like this:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Point tempPoint = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; Point(0, 0);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;private&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; imageSat_MouseMove(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; sender, MouseEventArgs e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;_isMouseInside = &lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Point p = e.GetPosition(imageSat);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;tempPoint.X = p.X / imageSat.ActualWidth&lt;/B&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;tempPoint.Y = p.Y / imageSat.ActualHeight;&lt;o:p&gt;&lt;/o:p&gt;&lt;/B&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;brushLight.Center = tempPoint;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;brushLight.GradientOrigin = tempPoint;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;H2 style="MARGIN: 10pt 0in 0pt"&gt;&lt;FONT face=Cambria color=#4f81bd size=4&gt;Mouse wheel control&lt;/FONT&gt;&lt;/H2&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;Is achieved by talking back to the DOM from the Silverlight app:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Page()&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;InitializeComponent();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;HtmlPage.Window.AttachEvent(&lt;SPAN style="COLOR: #a31515"&gt;"DOMMouseScroll"&lt;/SPAN&gt;, OnMouseWheelTurned);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;HtmlPage.Window.AttachEvent(&lt;SPAN style="COLOR: #a31515"&gt;"onmousewheel"&lt;/SPAN&gt;, OnMouseWheelTurned);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;HtmlPage.Document.AttachEvent(&lt;SPAN style="COLOR: #a31515"&gt;"onmousewheel"&lt;/SPAN&gt;, OnMouseWheelTurned);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;Note that there are several checks for IE, Opera, Mozilla and Safari because the underlying DOM implementation is not the same. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri&gt;&lt;FONT size=3&gt;The below code is a slightly modified version of the code on Jeff Prosise’s blog: &lt;/FONT&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%"&gt;&lt;A href="http://www.wintellect.com/cs/blogs/jprosise/archive/2008/03/18/mousewheel-zooms-in-silverlight-2-0.aspx" mce_href="http://www.wintellect.com/cs/blogs/jprosise/archive/2008/03/18/mousewheel-zooms-in-silverlight-2-0.aspx"&gt;http://www.wintellect.com/cs/blogs/jprosise/archive/2008/03/18/mousewheel-zooms-in-silverlight-2-0.aspx&lt;/A&gt;. &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri&gt;&lt;FONT size=3&gt;Peter Blois also has a good post wheel and deep zoom, if you’re interested: &lt;/FONT&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%"&gt;&lt;A href="http://blois.us/blog/2008/03/ive-heard-number-of-people-wondering.html" mce_href="http://blois.us/blog/2008/03/ive-heard-number-of-people-wondering.html"&gt;http://blois.us/blog/2008/03/ive-heard-number-of-people-wondering.html&lt;/A&gt; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;private&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; OnMouseWheelTurned(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; sender, HtmlEventArgs args)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (!_isMouseInside) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;double&lt;/SPAN&gt; delta = 0;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;ScriptObject e = args.EventObject;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (e.GetProperty(&lt;SPAN style="COLOR: #a31515"&gt;"wheelDelta"&lt;/SPAN&gt;) != &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;) &lt;SPAN style="COLOR: green"&gt;// IE and Opera&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;delta = ((&lt;SPAN style="COLOR: blue"&gt;double&lt;/SPAN&gt;)e.GetProperty(&lt;SPAN style="COLOR: #a31515"&gt;"wheelDelta"&lt;/SPAN&gt;));&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (HtmlPage.Window.GetProperty(&lt;SPAN style="COLOR: #a31515"&gt;"opera"&lt;/SPAN&gt;) != &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;delta = -delta;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;else&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (e.GetProperty(&lt;SPAN style="COLOR: #a31515"&gt;"detail"&lt;/SPAN&gt;) != &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;) &lt;SPAN style="COLOR: green"&gt;// Mozilla and Safari&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;delta = -((&lt;SPAN style="COLOR: blue"&gt;double&lt;/SPAN&gt;)e.GetProperty(&lt;SPAN style="COLOR: #a31515"&gt;"detail"&lt;/SPAN&gt;));&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;delta = &lt;SPAN style="COLOR: #2b91af"&gt;Math&lt;/SPAN&gt;.Sign(delta);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;MouseWheelTurned(delta);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (delta != 0)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;args.PreventDefault();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;e.SetProperty(&lt;SPAN style="COLOR: #a31515"&gt;"returnValue"&lt;/SPAN&gt;, &lt;SPAN style="COLOR: blue"&gt;false&lt;/SPAN&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;private&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; MouseWheelTurned(&lt;SPAN style="COLOR: blue"&gt;double&lt;/SPAN&gt; delta)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;brushLight.RadiusX += 0.46*0.06*delta;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;brushLight.RadiusY += 0.64*0.06*delta;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BACKGROUND: #d9d9d9; MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 217"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;I guess that by using the “Saturation light” method by combining 2 images, you can achieve any image effect you’d like. For example: making a person’s or animal’s eyes “light up” when you move over their picture, or making all kinds of dodge, burn, blurs, etc image effects.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8420193" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/nikola/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://blogs.msdn.com/nikola/archive/tags/Image/default.aspx">Image</category><category domain="http://blogs.msdn.com/nikola/archive/tags/Demo/default.aspx">Demo</category><category domain="http://blogs.msdn.com/nikola/archive/tags/Sample/default.aspx">Sample</category><category domain="http://blogs.msdn.com/nikola/archive/tags/Saturation+Light/default.aspx">Saturation Light</category><category domain="http://blogs.msdn.com/nikola/archive/tags/Effects/default.aspx">Effects</category></item></channel></rss>