Page 2 of 4

Re: looking for a pixel flood fill routine

Posted: Tue Oct 12, 2021 4:47 pm
by Symoon
I almost finished commenting (in French) the Retour du Dr Genius flood fill routine.
I'm just in a boring moment with real life, kind of "a new problem each day". When (if!) things calm down, I'll post it.

Re: looking for a pixel flood fill routine

Posted: Sun Oct 31, 2021 9:58 pm
by goyo
Nice !
but it's not urgent.
if you have the time, otherwise it's okay. :wink:

Re: looking for a pixel flood fill routine

Posted: Fri Nov 12, 2021 12:01 am
by Symoon
There it is! In French sorry, but I guess automatic translators can do the job if any non-French is curious.

Sorry it took so long, I struggled a lot with the stack management, I never found a long quiet moment to focus on it and understand. Now here we are ;)

BTW, the code is long, maybe it's worth to take a look at Geoff Philips' one in his book, I didn't test it but it might be easier / less memory consuming, etc.
retour_dr_Genius_routine_flood_fill.zip
(11.41 KiB) Downloaded 218 times

Re: looking for a pixel flood fill routine

Posted: Fri Nov 12, 2021 11:37 am
by Symoon
goyo wrote: Tue Oct 12, 2021 2:30 pm The Lorigraph floodfill Algo look like very speed and optimal but it's difficult to disassemble it for me.
Oh yes it looks much faster than Genius. Genuis looks nice and is no-so-slow, but I wonder if Lorigraph doesn't already use the idea I had (check/fill pixels by group of six before doing it of one by one).

Re: looking for a pixel flood fill routine

Posted: Fri Nov 12, 2021 12:01 pm
by Dbug
Symoon wrote: Fri Nov 12, 2021 11:37 am
goyo wrote: Tue Oct 12, 2021 2:30 pm The Lorigraph floodfill Algo look like very speed and optimal but it's difficult to disassemble it for me.
Oh yes it looks much faster than Genius. Genuis looks nice and is no-so-slow, but I wonder if Lorigraph doesn't already use the idea I had (check/fill pixels by group of six before doing it of one by one).
Yeah, a quick exit with a byte test makes sense :)

Re: looking for a pixel flood fill routine

Posted: Fri Nov 12, 2021 2:49 pm
by Symoon
Dbug wrote: Fri Nov 12, 2021 12:01 pm Yeah, a quick exit with a byte test makes sense :)
Well, I haven't deeply checked but I saw a CMP $40 while Lorigraph was executing the fill routine.
So I guess that's the idea ;)

So finally, it will probably be better to isolate Lorigraph's routine... Oh no, not again!

Re: looking for a pixel flood fill routine

Posted: Fri Nov 12, 2021 4:45 pm
by jbperin
Symoon wrote: Fri Nov 12, 2021 12:01 am There it is! In French sorry, but I guess automatic translators can do the job if any non-French is curious.
retour_dr_Genius_routine_flood_fill.zip
Waou :shock: nice work

It's very difficult to extract the meaning of an assembly code without knowing the design.
Well done.

Re: looking for a pixel flood fill routine

Posted: Fri Nov 12, 2021 5:02 pm
by Symoon
Thanks!
Well, at least I knew from the start what I was looking for, it helped a lot ;)

Re: looking for a pixel flood fill routine

Posted: Fri Nov 12, 2021 6:36 pm
by iss
@Symoon: Congrats for this huge amount of work!

Re: looking for a pixel flood fill routine

Posted: Fri Nov 12, 2021 9:33 pm
by Symoon
Thanks, that's not that much work, it's just me complaining about the lack of spare time ;)
If you're curious and need some help translating, just let me know (I kept it in French both by lazyness and for Goyo)

Re: looking for a pixel flood fill routine

Posted: Sun Jan 16, 2022 2:40 pm
by Dbug
I tried to get Geffers routine to work, without success.
paint.zip
(1.42 KiB) Downloaded 141 times
It's from the book https://library.defence-force.org/index ... =007084743

I tried to call it from BASIC doing that:

Code: Select all

HIRES
CURSET120,100,3
CIRCLE50,1
POKE 0,120:POKE 1,100
CALL #1000
and all I get is just 6 white pixels in the center.
image_2022-01-16_143923.png
image_2022-01-16_143923.png (7.02 KiB) Viewed 4422 times
I guess I must have missed something.

Re: looking for a pixel flood fill routine

Posted: Tue Jan 18, 2022 8:22 pm
by Dbug
I still did not manage to get Geffers assembler routine to run, but I managed to get the BASIC one to work, and then I converted it to C.
It still quite slow, but it does not explode on some relatively complex shape, so I guess it could relatively easily be converted to assembler.
image_2022-01-18_201908.png
image_2022-01-18_201908.png (9.32 KiB) Viewed 4353 times
You can find the source code for the two programs on the SVN repository:
https://osdn.net/projects/oricsdk/scm/s ... sic/paint/
https://osdn.net/projects/oricsdk/scm/s ... e/c/paint/

Re: looking for a pixel flood fill routine

Posted: Wed Jan 19, 2022 6:32 pm
by Dbug
I continued playing with the flood fill code, for the ones interested:


Re: looking for a pixel flood fill routine

Posted: Wed Jan 19, 2022 8:49 pm
by Symoon
Glad you tried Goeff's ones!
At the moment I gave up looking at the Lorigraph one. It was a bit complicated and couldn't spend time on it for a month. But it's the fastest of the (very few) I saw.

Re: looking for a pixel flood fill routine

Posted: Wed Jan 19, 2022 8:51 pm
by Chema
I'm interested! :)

I wonder if a lot of time is being wasted in the ROM curset function (maybe point too?) Are you using those to plot and to get the value of a pixel?

Use one of our fast putpixel or pixeladdress routines and you'll probably see it fly, but that would be assembler called within C, a bit of cheating :)