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:

    “If you chance to live and move and have your being in that thin stratum in which the events that make the news transpire,—thinner than the paper on which it is printed,—then these things will fill the world for you; but if you soar above or dive below that plane, you cannot remember nor be reminded of them.”
    —Henry David Thoreau (1817–1862)