Author Topic: Fill Fast Line algorithm  (Read 79 times)

Offline Qedo

  • Mr. Polyvector
  • ***
  • Posts: 139
    • View Profile
Fill Fast Line algorithm
« on: 2018-Aug-10 »
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

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2523
    • View Profile
Re: Fill Fast Line algorithm
« Reply #1 on: 2018-Aug-10 »
Cool, thanks Qedo!  :good:


“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)

Offline dreamerman

  • Mr. Polyvector
  • ***
  • Posts: 191
    • View Profile
    • my personal website
Re: Fill Fast Line algorithm
« Reply #2 on: 2018-Aug-13 »
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