I have been trying to perform a flood fill on an image with objective c in an app on an iPhone, and have come to a couple of dead ends, so I thought it would be a good idea to ask before going any further. At the moment the based routine is that I am getting the raw data from the image, and using a queue to implement the flood fill. The problem is that it takes more than a few seconds to complete. Unfortunately I don't have the code with me right now, so I guess I'll just resort to asking if I am going about it the wrong way. Is there something blatant in the API that I've missed? Or is my code just not optimized enough?
A:
See if these help:
http://stackoverflow.com/questions/367226/flood-fill-algorithms
http://stackoverflow.com/questions/1430962/
http://stackoverflow.com/questions/1879371/flood-fill-algorithm
If you're getting stack overflows, make sure each recursive call is not pushing large amounts of data (such as an image) onto the stack in the arguments.
Louis
2010-09-28 00:19:34
Thanks! One of those did the trick.
Jon Packer
2010-09-28 06:00:30
No worries, say hi to Elle for me.
Louis
2010-09-28 11:07:10