public boolean compareColors(Color a, Color b, int threshold) {
return (a.getRed() >= b.getRed() - threshold
|| a.getRed() <= b.getRed() + threshold
|| a.getGreen() >= b.getGreen() - threshold
|| a.getGreen() <= b.getGreen() + threshold
|| a.getBlue() >= b.getBlue() - threshold
|| a.getBlue() <= b.getBlue() + threshold);
}
It seems like this is a lot to check just to compare two colors, anyone have a better idea? This is java btw.


Sign In
Create Account

Back to top









