Skip to content
Yuri Pourre edited this page Mar 21, 2014 · 3 revisions

Flood Fill is the formal name of the "Paint Bucket Algorithm".

How it works:

This implementation of FloodFill starts in the first pixel of the target image looking the neighbors for candidate pixels this version only search for up, down, left and right neighboors, it could look each of the eight neighbors.

The natural way of doing this algorithm is using some recursive method to search all neighbors, if you are using a "not so powerful" device you can use all of it's memory (called Stack Overflow). I am using a queue to avoid this problem.

Usage:
Example:
Illustration:

Flood Fill Animation

This is a 4-direction Flood Fill animation extracted from wikipedia

Application:

Flood Fill is used in Etyllic-Paint to paint a region with bucket tool.

Clone this wiki locally