English
Source / code snippets

Iterativer Stackarray-basierter Floodfill Algorithmus (slow demonstration)

 

p.specht


Window Title "DEMO: Iterativer (Stackarray-basierter) Floodfill Algorithmus"
' (D) demonstration 2017-02 by P.woodpecker, Wien(AT)
font 2:declare x&[],y&[],stc&
'--------------------------------------------------
cls:Print "\n Floodfill-4"
usepen 0,1,rgb(255,0,0):usebrush 1,rgb(255,0,0)
roundrect 40,40 - 240,140;16;24
usepen 0,1,rgb(255,255,0):usebrush 1,rgb(255,0,0)
ellipsis 80,80 - 140,100
iter_fill4 100,100,rgb(255,0,0),rgb(0,0,255)
print "\n\n\n\n\n\n\n\n\n\n [TASTE]"
waitinput 5000

proc iter_fill4 :parameters x&,y&,alt&,neu&

    inc stc&:x&[stc&]=x&:y&[stc&]=y&

    while stc&

        x&=x&[stc&]:y&=y&[stc&]:dec stc&

        if getPixel(x&,y&)=alt&

            setPixel x&,y&,neu&
            inc stc&:x&[stc&]=x&+1:y&[stc&]=y&'>
            inc stc&:x&[stc&]=x&:y&[stc&]=y&-1'^
            inc stc&:x&[stc&]=x&-1:y&[stc&]=y&'<
            inc stc&:x&[stc&]=x&:y&[stc&]=y&+1'v

        endif

    endwhile

endproc

'--------------------------------------------------
cls:Print "\n\n Floodfill-8"
usepen 0,1,rgb(255,0,0):usebrush 1,rgb(255,0,0)
roundrect 40,40 - 240,140;16;24
usepen 0,1,rgb(255,255,0):usebrush 1,rgb(255,0,0)
ellipsis 80,80 - 140,100
iter_fill8 100,100,rgb(255,0,0),rgb(0,0,255)
print "\n\n\n\n\n\n\n\n\n\n with FF-8 is a Ellipsenrand 1 To thinly to that stop!"
beep:waitinput:End

proc iter_fill8 :parameters x&,y&,alt&,neu&

    inc stc&:x&[stc&]=x&:y&[stc&]=y&

    while stc&

        x&=x&[stc&]:y&=y&[stc&]:dec stc&

        if getPixel(x&,y&)=alt&

            setPixel x&,y&,neu&
            inc stc&:x&[stc&]=x&+1:y&[stc&]=y&'>
            inc stc&:x&[stc&]=x&+1:y&[stc&]=y&-1'>^
            inc stc&:x&[stc&]=x&  :y&[stc&]=y&-1'^
            inc stc&:x&[stc&]=x&-1:y&[stc&]=y&-1'<^
            inc stc&:x&[stc&]=x&-1:y&[stc&]=y&'<
            inc stc&:x&[stc&]=x&-1:y&[stc&]=y&+1'<v
            inc stc&:x&[stc&]=x&  :y&[stc&]=y&+1'v
            inc stc&:x&[stc&]=x&+1:y&[stc&]=y&+1'>v

        endif

    endwhile

endproc

'--------------------------------------------------
 
XProfan 11
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
05/24/21  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.269 Views

Untitledvor 0 min.
Erhard Wirth06/14/24
p.specht11/20/21
Uwe Lang11/20/21
Manfred Barei11/19/21
More...

Themeninformationen

this Topic has 1 subscriber:

p.specht (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie