title: improving speed of GetPixel function in c#
body: <p>i need to read getpixel of bmp with speed but is very low
  i used of LockBits </p>
  
  <pre><code>     private void LockUnlockBitsExample(Bitmap bmp)
      {
  
          Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
          System.Drawing.Imaging.BitmapData bmpData =
              bmp.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadWrite,
              bmp.PixelFormat);
          IntPtr ptr = bmpData.Scan0;
  
          int bytes  = Math.Abs(bmpData.Stride) * bmp.Height;
          rgbValues = new byte[bytes];
  
          System.Runtime.InteropServices.Marshal.Copy(ptr, rgbValues, 0, bytes);
          bmp.UnlockBits(bmpData);
      }
  </code></pre>
  
  <p>and this function </p>
  
  <pre><code>        private Color GetMyPixel(byte[] rgbValues,Bitmap bmp, int x,int y )
      {
  
          int index= (bmp.Width*y+x)*3;
          Color MyColor = Color.FromArgb(rgbValues[index], rgbValues[index + 1], rgbValues[index + 2]);
          return MyColor;
      }
  </code></pre>
  
  <p>but output of my function is different from original getpixel</p>