B
BartC
Ben Bacarisse said:Or you can replace the function with "return 1;"! You've lost track of
the purpose. If the image is cleared, all points will appear connected.
The input image A contains the original picture. The auxiliary local image B
is just a mask indicating what would be the flooded areas of A.
(Malcolm has since said that A is a 2-level image anyway - presumably what
he meant by 'binary-image'. These tend to be compact so a straight copy to a
local image seems simplest - once you've first checked the two points are
the same colour.
However, I also vaguely remember that he implements these using one
char per pixel. That means there are 254 possible values to pick for the
flood-fill, that do not clash with the colours of the image. Which I suppose
is similar to my idea, but using 7 spare bits that already permanently
exist, instead of the one temporary extra bit I proposed.)