Flood Fill - Scanline Fill

Scanline Fill

The algorithm can be sped up by filling lines. Instead of pushing each potential future pixel coordinate on the stack, it inspects the neighbour lines (previous and next) to find adjacent segments that may be filled in a future pass; the coordinates (either the start or the end) of the line segment are pushed on the stack. In most cases this scanline algorithm is at least an order of magnitude faster than the per-pixel one.

Efficiency: each pixel is checked once.

Read more about this topic:  Flood Fill

Famous quotes containing the word fill:

    We long for our father. We wear his clothes, and actually try to fill his shoes. . . . We hang on to him, begging him to teach us how to do whatever is masculine, to throw balls or be in the woods or go see where he works. . . . We want our fathers to protect us from coming too completely under the control of our mothers. . . . We want to be seen with Dad, hanging out with men and doing men things.
    Frank Pittman (20th century)