Even though the function is recurssive in nature it never recurse. I am completely blank why this is happening.
public void fill(Graphics g, View v, Point interior, Color boundaryColor, Color interiorColor) {
int x = interior.getx();
int y = interior.gety();
System.out.println("x: "+x+" y: "+y);
int pixelColor = v.getPixel(x, y);//always negative or zero
if( pixelColor == 0) {
System.out.println("Exit case");
return;
}
if( (pixelColor != boundaryColor.getRGB()) && (pixelColor != interiorColor.getRGB())) {
System.out.println("*");
interior.drawPoint(g, v);
int nextX, nextY;
nextX = x+1;
nextY = y;
Point p= new Point(v, nextX, nextY);
this.fill(g, v, p, boundaryColor, interiorColor);
}
}
Explanation: View v, Graphics g and Point interior are custom objects;
If the function has been recursive in nature it might have printed "Exit Case when the exit case is reached"
Code execution results:
