public void Given1PixelBitmap_Returns1PixelBitmap() { var bitmap = new Bitmap(1, 1); var result = bitmap.RGBADownSample(); Assert.That(result.Width, Is.EqualTo(1)); Assert.That(result.Height, Is.EqualTo(1)); }
public void Given1PixelBitmap_ReturnsSamePixel() { var bitmap = new Bitmap(1, 1); bitmap.SetPixel(0,0, Color.FromArgb(128, 255, 255, 255)); var result = bitmap.RGBADownSample(); Assert.That(result.GetPixel(0, 0).A, Is.EqualTo(bitmap.GetPixel(0, 0).A)); }
public void Given2x2PixelBitmap_ReturnsAverage() { var bitmap = new Bitmap(2, 2); bitmap.SetPixel(0, 0, Color.FromArgb(0, 255, 255, 255)); bitmap.SetPixel(0, 1, Color.FromArgb(63, 255, 255, 255)); bitmap.SetPixel(1, 0, Color.FromArgb(127, 255, 255, 255)); bitmap.SetPixel(1, 1, Color.FromArgb(191, 255, 255, 255)); var result = bitmap.RGBADownSample(); Assert.That(result.GetPixel(0, 0).A, Is.EqualTo(95)); }