Fill Fast Line algorithm

Previous topic - Next topic

Qedo

After i have grabbing with both hands in the forum a small summer gift (I hope it will be appreciated).
You find the scanline floodfill algorithm using stack instead of recursion.
I converted the version I found in internet from C++ to GlBasic.
Compared to the standard version this is much faster about 10-15 times.
When you start the program for the first 10 seconds, the standard (more slow) version is executed and  after the scanline version.
The program uses my FASTMEM2SPRITE version (which you already sent a while ago and which I have now improved), but you can comment the command and activate the standard MEM2SPRITE to appreciate even more the change of speed.
Let me know

bigsofty

Cool, thanks Qedo!  :good:
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

dreamerman

Nice, good to have such code ready for use in future. Did you tried other filling algorithms, even just to compare speed? Don't know what impact have those DIMPUSH / DELETE commands.
Check my source code editor for GLBasic - link Update: 20.04.2020

Qedo

dreamerman, I searched the internet for the best filling algorithm and implemented it in GLB. I do not think there are others, but I can be wrong.
At the beginning I was very doubtful about the efficiency of DIMPUSH / DELETE and the FOREACH / NEXT cycle but I have to say that I'm not a real bottleneck. To get rid of all doubts it would be interesting to implement it in c ++ but for the moment I am satisfied with this version.