Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am working on a game in which I have to fill a closed region with color. Currently I'm using a non-recursive, scanline-based flood filling algorithm. But in my case it is slow. Can anyone provide me the quickest, most efficient floodfill algorithm code or link?

share|improve this question
up vote 5 down vote accepted

Google provides several links that may be starting points: here, here and here for example.

There isn't likely to be an actual "fastest" or "best" algorithm -- there rarely is. Rather you'll find some are more suited for particular scenarios. You have not provided enough information about your scenario or what you have tried yourself in order for us to provide really directed answers. Also, have you profiled your code and identified the bottleneck(s)?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.