protected RGBXY[] newfindRGBXYs(short[][][] colorMap, Rectangle bounds, Rectangle ignore[], RGB rgb, int maxMatches, int redTolerance, int greenTolerance, int blueTolerance) { int x, y, i, redChange, greenChange, blueChange; int height = bounds.y + bounds.height; int width = bounds.x + bounds.width; ArrayList list = new ArrayList(10); boolean ignoreSpot; for (x = bounds.x; x < width; x++) { for (y = bounds.y; y < height; y++) { if (ignore != null) { ignoreSpot = false; for (i = 0; i < ignore.length; i++) { if (ignore[i].contains(x, y)) { ignoreSpot = true; break; } } if (ignoreSpot) { continue; } } redChange = rgb.r - colorMap[x][y][0]; if ((redChange >= 0 ? redChange : -redChange) > redTolerance) { continue; } greenChange = rgb.g - colorMap[x][y][1]; if ((greenChange >= 0 ? greenChange : -greenChange) > greenTolerance) { continue; } blueChange = rgb.b - colorMap[x][y][2]; if ((blueChange >= 0 ? blueChange : -blueChange) > blueTolerance) { continue; } list.add(new RGBXY(colorMap[x][y], x, y)); if (list.size() > maxMatches) { break; } } if (list.size() > maxMatches) { //log("findRGBXYs() STOP, at " + maxMatches // + " RGBXY matched, reduce tolerance?"); break; } } RGBXY resultRGBXY[] = new RGBXY[list.size()]; for (i = 0; i < resultRGBXY.length; i++) { resultRGBXY[i] = (RGBXY) list.get(i); } return resultRGBXY; }//newrgbxys