You don't have to impose a limit on the depth of the floodfill. Just use a line flood
fill, that doesn't require much stack space.
The algorithm is very simple, and is something like:
1. Draw the current line from left to right.
2. While drawing, check the line above the current one. If the pixel color changes
from border to background, push the pixel
coordinates on the stack. When you finish drawing the line, if the pixel above the
last one has the background color, push its
coordinates on the stack.
3. Pop the first coordinate from the stack and restart the process
This draws bottom to top. If you need to go both directions, just check both the line
above and the line below the current one.
This is the fastest border-limited floodfill I know.
Aaron Ardiri wrote:
> > Actually thi is a very good idea!
> > I'm going to try it right away!
>
> have you thought about using bresenham's algorithm for generating
> circles? you could use the same concept and fill across until the
> point on the arc from the right edge (or whatever edge it is)
>
> you want to minimize the amount of pixel sets you are doing :))
> you might find a flood-fill (recursive) will be easier to code
> tho.. just limit it to do 5x5 areas.. and then start a flood
> fill if necessary in adjacent areas..
>
> az.
> --
> Aaron Ardiri
> Java Certified Programmer http://www.hig.se/~ardiri/
> University-College i G�vle mailto:[EMAIL PROTECTED]
> SE 801 76 G�vle SWEDEN
> Tel: +46 26 64 87 38 Fax: +46 26 64 87 88
> Mob: +46 70 656 1143 A/H: +46 8 668 78 72
>
> if you enjoy it, then it aint work :) - rule #106 of life
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe, please see
>http://www.palm.com/devzone/mailinglists.html
--
Sergio Carvalho
---------------
[EMAIL PROTECTED]
[EMAIL PROTECTED]
If at first you don't succeed, skydiving is not for you
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html