Code : Tout sélectionner
InitSprite()
InitMouse()
InitKeyboard()
UseJPEGImageDecoder()
Dim r.w(1024,768)
Dim v.w(1024,768)
Dim b.w(1024,768)
Dim p(1024*768)
Dim rr.b(1024,768)
For i=0 To 100
rr(Random(1023),Random(767))=Random(2)+1
Next
OpenScreen(1024,768,32,"")
LoadSprite(0,"pic1024*768.jpg")
DisplaySprite(0,0,0)
StartDrawing(SpriteOutput(0))
For u=0 To 767
For i=0 To 1023
x=Point(i,u)
r(i,u)=Red(x)
v(i,u)=Green(x)
b(i,u)=Blue(x)
Next
Next
StopDrawing()
FreeSprite(0)
w=-1
w1=1
w2=2
w3=3
www=2000
Repeat
StartDrawing(ScreenOutput())
For u=0 To 767
For i=0 To 1023
Plot(i,u,RGB(r(i,u),v(i,u),b(i,u)))
Next
Next
StopDrawing()
FlipBuffers()
For n=1 To 60000
a=Random(1022)+1
b=Random(766)+1
If rr(a,b)=w1
For i=-1 To 1
For u=-1 To 1
rr(a+i,b+u)=w1
If Random(30)<>0
r(a+i,b+u)+w
If r(a+i,b+u)<0
r(a+i,b+u)=0
EndIf
EndIf
Next
Next
EndIf
If rr(a,b)=w2
For i=-1 To 1
For u=-1 To 1
rr(a+i,b+u)=w2
If Random(30)<>0
v(a+i,b+u)+w
If v(a+i,b+u)<0
v(a+i,b+u)=0
EndIf
EndIf
Next
Next
EndIf
If rr(a,b)=w3
For i=-1 To 1
For u=-1 To 1
rr(a+i,b+u)=w3
If Random(30)<>0
b(a+i,b+u)+w
If b(a+i,b+u)<0
b(a+i,b+u)=0
EndIf
EndIf
Next
Next
EndIf
Next
www-5
If Random(www)<10
w0=w1
w1=w2
w2=w3
w3=w0
www=2000
EndIf
ExamineKeyboard() : Until KeyboardPushed(#PB_Key_Escape): End
