[comp.lang.pascal] Fill procedure for 320by200 with 256 color mode?

wyuu@uhunix1.uhcc.Hawaii.Edu (Wesley Yuichi Yuu) (06/21/91)

Hiya.
 I finally found the author of the loadimage and saveimage routines..
(the routines which saves an individual image to a file, and can be
loaded with loadimage..) He sez he'll post it soon again. 
 
 My question now is with floodfill. I am currently using turbo pascal
5.0 (I know.. dark ages..) and creating an arcade game, and a fill
function would be great, the only thing is, that the included floodfill
routine doesnt work. Upon RTFM, I found that when I use the VGA256.BGI
(320by200 with 256 color) mode, floodfill would not work. I tried creating
my own floodfill, but I always get buffer overflow..(too recursive 
intensive..) I was wondering if anybody has a clean and workable fill
algo that I could use, or where I could ftp one from..

						thank you ..
						and mahalo..(redundent..)

Ho hum.. another day in paradise..

andreww@uniwa.uwa.oz (Andrew John Williams) (06/22/91)

(Someone having trouble with flood-fill)

The way I always do it is (roughly)

scan left until you find a border pixel. Check pixel above. If it is not
border, push it to a stack. Same for below. Then scan right, setting
pixels, and checking the pixels above and below. If the pixel above
(below) is not border and the one to the left of it is, push it to the
stack. When you hit a border pixel (on this line), pop a pixel from the
stack and start again from there. This method can survive with extremely
small stacks, and is one of the fastest methods I've seen (after a few
tweaks such as forgetting pixels and going a word at a time).
But I'm not sure that flood-fills are good for arcade games. They are
VERY slow. I don't know exactly what you want it for, but you might
consider a polygon-fill instead.

John West (stealing Andrew's account)
Why is this fish in my ear?