private bool ClearAndCheckImage(ImageBuffer image, RGBA_Bytes color) { image.NewGraphics2D().Clear(color); for (int y = 0; y < image.Height; y++) { for (int x = 0; x < image.Width; x++) { if (image.GetPixel(x, y) != color) { return false; } } } return true; }
private bool ClearAndCheckImage(ImageBuffer image, RGBA_Bytes color) { image.NewGraphics2D().Clear(color); for (int y = 0; y < image.Height; y++) { for (int x = 0; x < image.Width; x++) { if (image.GetPixel(x, y) != color) { return(false); } } } return(true); }
private void DEBUG_saveImageBuffer(ImageBuffer buf) { int hash = 0; var bounds = buf.GetBounds (); System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap (bounds.Width, bounds.Height, PixelFormat.Format32bppArgb); for (int x = 0; x < bounds.Width; x++) { for (int y = 0; y < bounds.Height; y++) { var pcolor = buf.GetPixel (x, y); var wcolor = Color.FromArgb (pcolor.alpha, pcolor.red, pcolor.green, pcolor.green); hash += wcolor.ToArgb () ^ 0x1f2f019f; hash <<= 1; bitmap.SetPixel (x, y, wcolor); } } string filename = String.Format (@"C:\tmp\masktest-{0}.bmp", hash); if (!System.IO.File.Exists (filename)) { bitmap.Save (filename, ImageFormat.Bmp); } }