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:

    But the mark of American merit in painting, in sculpture, in poetry, in fiction, in eloquence, seems to be a certain grace without grandeur, and itself not new but derivative; a vase of fair outline, but empty,—which whoso sees, may fill with what wit and character is in him, but which does not, like the charged cloud, overflow with terrible beauty, and emit lightnings on all beholders.
    Ralph Waldo Emerson (1803–1882)