Flood Fill Help

BlitzMax Forums/BlitzMax Programming/Flood Fill Help

Presuming you're only filling up only a single colour.
What you could is scan the image and make a lookup table (array the size of your image) of all the valid pixels you can write too and ones that you can't, true and false.

Then you can perform all your gfx operations by just consulting the lookup table and you'll only need to plot the pixels, should cut down significantly on the number of readpixels going on, quicker to read your array of ints.

Briefly scanning your code you appear to be kind of like bleeding your pixels around and checking its neighbours, looking at true or false values is better than checking the colours every time (since you're often checking the same pixel more than once)

May be worth a look, might be faster.