title: Extracting RGB from a pixel without color object in C#
body: <p>I am trying to extract R G B values from a pixel in the following code:</p>
  
  <pre><code>for ( int i=0; i &lt; pixeldata.length; i++)
      {
          IntPtr ptr = bmd.Scan0+i;
          byte* pixel = (byte*)ptr;
  
          //here is the problem :O
  
          float r = pixel[1];
          float g = pixel[2];
          float b = pixel[3];
       }
  ....
  </code></pre>
  
  <p>where bmd is an array of pixels data:</p>
  
  <pre><code>BitmapData bmd = source.LockBits(rect, ImageLockMode.ReadOnly, source.PixelFormat);
  </code></pre>
  
  <p>and source is the Bitmap of my input, which is an image. 
  I am trying to avoid the use of Color object. I have already done that and it works, I want to use this other way, but the issue is that ptr is a number and I have to extract the R G B from it. </p>