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:

    Plantin’ and readin’, plantin’ and readin’. Fill a man full of lead, stick ‘em in the ground, and then read words on ‘em. Why when ya killed a man, why try to read the Lord in as a partner on the job.
    Borden Chase [Frank Fowler] (1900–1971)