protected bool CompareColor(ScreenshotColor refColor, ScreenshotColor actualColor, Tolerance tolerance) { // Simply compare the discrepancy of the R, G and B values // of each color. for (int i = 0; i < 3; i++) { byte bRef = refColor.GetValueFromIndex(i); byte bAct = actualColor.GetValueFromIndex(i); if (!(Math.Abs(bRef - bAct) <= tolerance.GetValueFromIndex(i))) { return(false); } } return(true); }
protected bool CompareColor(ScreenshotColor refColor, ScreenshotColor actualColor, Tolerance tolerance) { // Simply compare the discrepancy of the R, G and B values // of each color. for (int i = 0; i < 3; i++) { byte bRef = refColor.GetValueFromIndex(i); byte bAct = actualColor.GetValueFromIndex(i); if (!(Math.Abs(bRef - bAct) <= tolerance.GetValueFromIndex(i))) return false; } return true; }