rendered paste body protected void populateEdges(int tolerance, int incrementation)
throws InterruptedException {
short[][][] original = theColorScriptable.getColorMap();
short[][][] originalSlice = new short[width][height][3];
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
originalSlice[x][y][0] = original[x + xStart][y + yStart][0];
originalSlice[x][y][1] = original[x + xStart][y + yStart][1];
originalSlice[x][y][2] = original[x + xStart][y + yStart][2];
}
}
original = null;
theColorScriptable.waitTillNextFrame();
short[][][] next = theColorScriptable.getColorMap();
short[][][] nextSlice = new short[width][height][3];
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
nextSlice[x][y][0] = next[x + xStart][y + yStart][0];
nextSlice[x][y][1] = next[x + xStart][y + yStart][1];
nextSlice[x][y][2] = next[x + xStart][y + yStart][2];
}
}
next = null;
for (int x = 0; x < width; x += incrementation)
for (int y = 0; y < height; y += incrementation) {
if (originalSlice[x][y][0] != nextSlice[x][y][0]
|| originalSlice[x][y][1] != nextSlice[x][y][1]
|| originalSlice[x][y][2] != nextSlice[x][y][2]) {
GameScreenEdges[x][y] = true;
}
}
}