Simple wave recursive algorithms of filling areas

Wave algorithm

    This algorithm assigns a new color to the points of a 4-contiguous area if the given point complies with the condition that it is inside of the area being filled.

$$$APPLET

Applet Filling of areas. Set a starting point.

Wave algorithm filling:

void Filling (int x,int y,Color old_color,Color new_color)
 {
    if (read_pixel (x,y) == old_color) // pixel color test
        {
           write_pixel (x, y, new_color);  // paints the pixel in a new color
           Filling (x, y-1, old_color, new_color);
           Filling (x, y+1, old_color, new_color);
           Filling (x-1, y, old_color, new_color);
           Filling (x+1, y, old_color, new_color);
        }
 }