internal void DrawImage(ManagedBitmap bmp, Point point) { for (int y = 0; y < bmp.Height; y++) { int newY = point.Y + y; if (newY >= 0 && newY < Height) { for (int x = 0; x < bmp.Width; x++) { int newX = point.X + x; if (newX >= 0 && newX < Width) { this.SetPixel(newX, newY, bmp.GetPixel(x, y)); } } } } }
internal static int IsBitmapsAlike(NikseBitmap bmp1, ManagedBitmap bmp2) { int different = 0; int maxDiff = bmp1.Width * bmp1.Height / 5; for (int x = 1; x < bmp1.Width; x++) { for (int y = 1; y < bmp1.Height; y++) { if (!IsColorClose(bmp1.GetPixel(x, y), bmp2.GetPixel(x, y), 20)) { different++; } } if (different > maxDiff) { return(different + 10); } } return(different); }
internal static unsafe int IsBitmapsAlike(NikseBitmap bmp1, ManagedBitmap bmp2) { int different = 0; int maxDiff = bmp1.Width * bmp1.Height / 5; for (int x = 1; x < bmp1.Width; x++) { for (int y = 1; y < bmp1.Height; y++) { if (!IsColorClose(bmp1.GetPixel(x, y), bmp2.GetPixel(x, y), 20)) different++; } if (different > maxDiff) return different + 10; } return different; }
private static int CalculateNumberOfForegroundColors(ManagedBitmap managedBitmap) { int count = 0; for (int y = 0; y < managedBitmap.Height; y++) { for (int x = 0; x < managedBitmap.Width; x++) { Color c = managedBitmap.GetPixel(x, y); if (c.A > 100 && c.R + c.G + c.B > 200) count++; } } return count; }
internal void DrawImage(ManagedBitmap bmp, Point point) { for (int y = 0; y < bmp.Height; y++) { int newY = point.Y + y; if (newY >= 0 && newY < Height) { for (int x = 0; x < bmp.Width; x++) { int newX = point.X + x; if (newX >= 0 && newX < Width) this.SetPixel(newX, newY, bmp.GetPixel(x, y)); } } } }