title: Converting Int to Color in C# for Silverlight's WriteableBitmap
body: <p>In Silverlight 3 there is now a WriteableBitmap which provides get/put pixel abilities. This can be done like so:</p>
  
  <pre><code>// setting a pixel example
  WriteableBitmap bitmap = new WriteableBitmap(400, 200);
  Color c = Colors.Purple;
  bitmap.Pixels[0] = c.A &lt;&lt; 24 | c.R &lt;&lt; 16 | c.G &lt;&lt; 8 | c.B;
  </code></pre>
  
  <p>Basically, setting a Pixel involves setting its color, and that comes by bitshifting the alpha, red, blue, green values into an integer. </p>
  
  <p>My question is, how would you turn an integer back to a Color? What goes in the missing spot in this example:</p>
  
  <pre><code>// getting a pixel example
  int colorAsInt = bitmap.Pixels[0];
  Color c;
  // TODO:: fill in the color c from the integer ??
  </code></pre>
  
  <p>Thanks for any help you might have, I'm just not up on my bit shifting and I'm sure others will run into this roadblock at some point.</p>