Working Algorithm
private void fillSouth(int x, int y, int fill, int old) {
if (y >= raster.height) return;
if (raster.getPixel(x, y) == old) {
raster.setPixel(fill, x, y);
fillEast(x+1, y, fill, old);
fillSouth(x, y+1, fill, old);
fillWest(x-1, y, fill, old);
}
}
You can figure out the other routines yourself.
|