[comp.graphics] Need floodfill algorithm

kemp@umn-cs.CS.UMN.EDU (Stuart R. Kemp) (08/22/89)

I need an algorithm that will implement a floodfill, given
a boundary color, and any interior point. The algorithm
must work for ANY possible region.

Thanks,
-Stuart Kemp

josh@cditi.UUCP (Josh Muskovitz) (08/22/89)

In article <15334@umn-cs.CS.UMN.EDU>, kemp@umn-cs.CS.UMN.EDU (Stuart R. Kemp) writes:
> I need an algorithm that will implement a floodfill, given
> a boundary color, and any interior point. The algorithm
> must work for ANY possible region.

In the case where the region is:

	xxxxxxxxxxxxxxxxxxxxxxxx
	xxxxxxx..........xxxxxxx
	xxxxxx.xxxxxxxxxx.xxxxxx
	xxxxxx.xxxxxxxxxx.xxxxxx
	xxxxxx.xxxxxxxxxx.xxxxxx
	xxxxxxx..........xxxxxxx
	xxxxxxxxxxxxxxxxxxxxxxxx

would the region bleed out to the borders?

Just curious...

-- josh
  __________________________  _________________________________________________
 / _                         /                                                /
/ (")  The Killer Eggplant  / "Those who tell lies cannot be pure at heart,  /
  (_)   josh@uunet!cditi   / and only the pure at heart can make good soup."/
__________________________/                        - Ludwig Van Beethoven  /
   _______________________________________________________________________/
  /                                                                      /
 /                      Place standard disclaimer here.                 /
/ _____________________________________________________________________/

frank@ladc.bull.com (Frank Mayhar) (08/24/89)

In article <496@cditi.UUCP> josh@cditi.UUCP (Josh Muskovitz) writes:
>In the case where the region is:
>	xxxxxxxxxxxxxxxxxxxxxxxx
>	xxxxxxx..........xxxxxxx
>	xxxxxx.xxxxxxxxxx.xxxxxx
>	xxxxxx.xxxxxxxxxx.xxxxxx
>	xxxxxx.xxxxxxxxxx.xxxxxx
>	xxxxxxx..........xxxxxxx
>	xxxxxxxxxxxxxxxxxxxxxxxx
>would the region bleed out to the borders?

Depends on the algorithm.  Most would not, since they only look up, down,
left and right for border pixels.
-- 
Frank Mayhar  frank@ladc.bull.com (..!{uunet,hacgate,rdahp}!ladcgw!frank)
              Bull HN Information Systems Inc.  Los Angeles Development Center
              5250 W. Century Blvd., LA, CA  90045    Phone:  (213) 216-6241