filling/painting/coloring algorithm

which takes Sobel/Scharr into account