title: WPF WriteableBitmap problems with transparency
body: <p>First of all Ill explain what I try to do, just in the case that someone comes up with a better approach 
  I need to blend too images using the "color" stile from photoshop (you know, the blending methods: Screen, hard light, color ... )</p>
  
  <p>So, I have my base image (a png) and WriteableBitmap generated on execution time (lets call it color mask). Then I need to blend this two images using the "color" method and show the result in a UI component.</p>
  
  <p>So far what Im trying is just to draw things on the WriteableBitmap but I'm facing unexpected behavior with the alpha channel.</p>
  
  <p>My code so far:</p>
  
  <pre><code>// variables declaration
  WriteableBitmap img = new  WriteableBitmap(width, height, 96,96,PixelFormats.Bgra32,null); 
  pixels = new uint[width * height];
  
  //function for setting the color of one pixel
  private void SetPixel(int x, int y, Color c)
      {
          int pixel = width * y + x;
  
          int red = c.R;
          int green = c.G;
          int blue = c.B;
          int alpha = c.A;
  
          pixels[pixel] = (uint)((blue &lt;&lt; 24) + (green &lt;&lt; 16) + (red &lt;&lt; 8) + alpha);
  
      }
  
  //function for paint all the pixels of the image
  private void Render()
      {
          Color c = new Color();
          c.R = 255; c.G = 255; c.B = 255; c.A = 50;
          for (int y = 0; y &lt; height; y++)
              for (int x = 0; x &lt; width; x++)
                  SetPixel(x, y, c);
  
  
  
          img.WritePixels(new Int32Rect(0, 0, width, height), pixels, width * 4, 0);
          image1.Source = img;  // image1 is a WPF Image in my XAML
      }
  </code></pre>
  
  <p>Whenever I run the code with the color c.A = 255 I get the expected results. The whole Image is set to the desired color.  But if I set c.A to a different value I get weird things.
  If I set the color to BRGA = 0,0,255,50  I get a dark blue almost black. If I set it to BRGA = 255,255,255,50 I get a yellow ... </p>
  
  <p>Any clue !?!?!</p>
  
  <p>Thanks in advance !</p>