Where can't you would be a better question. Google should pop this one =
out really quickly.
The flood fill algorithm is pretty simple. You pretty much do this per =
node - fill it, recurse to any neighbour node (or pixel) with the same =
value as the original (doing the same thing).
Ie, in pseudo C code
void Fill(Node* x,Colour* original,Colour* newc) {
node->nodecol=3Dnewc; // Colour this node
for all n neighbours of X =20
if (node->neighbour[n]->nodecol=3D=3Doriginal)
Fill(node->neighbour[n],original,newc);
}
There is the scan line method, but that basically has a scanline run =
(ie, you calculate a vertical/horizontal length that is all the same =
colour), but it is essentially the same algorithm (with a bit of a speed =
up).=20
Conor Stokes
----- Original Message -----=20
From: Per Jahn=20
To: gda...@li...=20
Sent: Saturday, September 08, 2001 3:17 PM
Subject: [Algorithms] floodfill
Where can I find a description of the floodfill algorithm, with some =
good C-source?
=20
=20
/ Per
=20
|