private static int detectEndSecondRedLine(Bitmap bmp, int initRedX)
{
int redX = -1;
try {
for (int w = initRedX; w < bmp.Width; w++){
Color c = bmp.GetPixel(w, 0);
if (c.R != 255){
bool isRedLine = true;
for (int h = 0; h < bmp.Height; h++){
c = bmp.GetPixel(w-1, h);
if (c.R != 255)
{
isRedLine = false;
break;
}
}
if (isRedLine)
{
redX = w - 1;
break;
}
}
}
}
catch (Exception e) { }
return redX;
}