public bool Compare(ref Bitmap img, Color color, bool isUseForeground)
{
if (isUseForeground)
{
foreach (var point in Bad)
{
if ((img.Width > point.X) && (img.Height > point.Y))
{
var pix = img.GetPixel(point.X, point.Y);
if ((pix.R == color.R) && (pix.G == color.G) && (pix.B == color.B))
{
return false;
}
}
else
{
return false;
}
}
foreach (var point in Good)
{
if ((img.Width > point.X) && (img.Height > point.Y))
{
var pix = img.GetPixel(point.X, point.Y);
if ((pix.R != color.R) || (pix.G != color.G) || (pix.B != color.B))
{
return false;
}
}
else
{
return false;
}
}
return true;
}
else
{
foreach (var point in Bad)
{
if ((img.Width > point.X) && (img.Height > point.Y))
{
var pix = img.GetPixel(point.X, point.Y);
if ((pix.R != color.R) || (pix.G != color.G) || (pix.B != color.B))
{
return false;
}
}
else
{
return false;
}
}
foreach (var point in Good)
{
if ((img.Width > point.X) && (img.Height > point.Y))
{
var pix = img.GetPixel(point.X, point.Y);
if ((pix.R == color.R) && (pix.G == color.G) && (pix.B == color.B))
{
return false;
}
}
else
{
return false;
}
}
return true;
}
}