| |
|
|
 p.specht
 |
Título de la ventana "DEMO: Iterativer (Stackarray-basierter) Floodfill Algorithmus"
' (D) Demo 2017-02 by P.Pájaro carpintero, Wien(AT)
font 2:declarar x&[],y&[],stc&
'--------------------------------------------------
cls:Imprimir "\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)
ellipse 80,80 - 140,100
iter_fill4 100,100,rgb(255,0,0),rgb(0,0,255)
imprimir "\n\n\n\n\n\n\n\n\n\n [TASTE]"
waitinput 5000
proc iter_fill4 :parámetros x&,y&,alt&,neu&
inc stc&:x&[stc&]=x&:y&[stc&]=y&
mientras que 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:Imprimir "\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)
ellipse 80,80 - 140,100
iter_fill8 100,100,rgb(255,0,0),rgb(0,0,255)
imprimir "\n\n\n\n\n\n\n\n\n\n En FF-8 es una Ellipsenrand 1 a dünn para stoppen!"
beep:waitinput:End
proc iter_fill8 :parámetros x&,y&,alt&,neu&
inc stc&:x&[stc&]=x&:y&[stc&]=y&
mientras que 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 11Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'... | 24.05.2021 ▲ |
|
|
|