I\'m working on a small drawing application in Java. I\'m trying to create a \'bucket-fill\' tool by implementing the Flood Fill algorithm.
I tried using a recursion
EDIT: watch this video: https://www.youtube.com/watch?v=LvacRISl99Y
My results using the above method are about 10 million pixels per second. I researched it to fill 2 billion voxels space with laberinthine structures, in about 2-3 minutes, avoiding stack overflows.
Instead of using complex logic to track previously verified neighbor spaces, I have a 2D array that records all the verified spaces. Reading from the verified array is 2-3 instructions: IF pixel[23,23] is verified, THEN fill it and check it's neighbors and write them to the verified array (fill pixel[23,23], verify pixel[23+1,23]and the three others. code is in the video.