Boundary Fills
Boundary fills start from a point known to be inside of a region
and fill the region until a boundry is found.


A simple recursive algorithm can be used:

    public void boundaryFill(int x, int y, int fill, int boundary) {
        if ((x < 0) || (x >= width)) return;
        if ((y < 0) || (y >= height)) return;
        int current = raster.getPixel(x, y);
        if ((current != boundary) && (current != fill)) {
            raster.setPixel(fill, x, y);
            boundaryFill(x+1, y, fill, boundary);
            boundaryFill(x, y+1, fill, boundary);
            boundaryFill(x-1, y, fill, boundary);
            boundaryFill(x, y-1, fill, boundary);
        }
    }
	
Lecture 4   Slide 8   6.837 Fall '00