title: C# bitmap from 2D Array
body: <p>I am trying to build a bitmap from a 2D array, with a low size just for testing.
  Even if I set the matrix properly (one pix black, one white), when I build the bitmap it seems like some interpolation filter is applied. How I can get just pixel values?</p>
  
  <pre><code>bool switchColor = false;
  int width = 30;
  int height = 15;
  int stride = width * 4;
  int[,] integers = new int[width, height];
  
  int thres = 0;
  for (int i = 0; i &lt; width; ++i)
  {
      for (int j = 0; j &lt; height; ++j)
      {                        
          if (switchColor) 
          {
              switchColor = false;
              thres = 0;
          }
          else 
          { 
              switchColor = true;
              thres = 255;
          }
          byte[] bgra = new byte[] { (byte)(thres), (byte)(thres), (byte)(thres), 255 };
          integers[i, j] = BitConverter.ToInt32(bgra, 0);
      }
  }
  
  // Copy into bitmap
  Bitmap bitmap;
  unsafe
  {
      fixed (int* intPtr = &amp;integers[0, 0])
      {
          bitmap = new Bitmap(width, height, stride, PixelFormat.Format32bppRgb, new IntPtr(intPtr)); 
          pictureBox1.Image = bitmap;                                         
      }
  }
  </code></pre>
  
  <p>I've got:</p>
  
  <p><a href="https://i.stack.imgur.com/iBY1J.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iBY1J.png" alt="enter image description here"></a></p>