-une qui permet de sélectionner des couleurs prédéfinies ( touche de 1 à 5 )
-la deuxième permet de sélectionner une image par rapport à des coordonnées prédéfinies (touche AZERT...GHJK)
il y a deux programmes
-le premièr en "sse2" devrait fonctionner sur la majorité des PC
-le deuxième pour les PC plus recent
version 'sse2'
Code : Tout sélectionner
EnableExplicit
Global limit=255,ex=1280,ey=720, i,x,y,z,b,dx,dy,pass=-1,cpt=4,t
Global.d apx,px, apy,py,ascale,scale, scalecx.d , scalezx.d
Global Dim pal.l(limit)
Global Dim Bmp.l(ey - 1, ex - 1)
Global ndt=CountCPUs(#PB_System_ProcessCPUs )
Global Dim Thread(ndt)
Structure posst
x.d
y.d
EndStructure
Global Dim pos.posst(99)
Global position=0
Procedure ColorBlend(color1.l, color2.l, blend.f)
Protected r.w,g.w,b.w,a.w
r= Red(color1) + (Red(color2) - Red(color1)) * blend
g=Green(color1) + (Green(color2) - Green(color1)) * blend
b= Blue(color1) + (Blue(color2) - Blue(color1)) * blend
a=Alpha(color1) + (Alpha(color2) - Alpha(color1)) * blend
ProcedureReturn RGBA(r,g,b,a)
EndProcedure
Procedure InitPalette(n=16,Cont=0)
Protected i,j,c1,c2
c2=Random($ffffff)
For j = 0 To limit/n
If Cont:c1=c2:Else:c1=Random($ffffff):EndIf
c2=Random($ffffff)
For i=0 To n-1
pal(j*n+i) =ColorBlend(c1,c2, i/ n) | $ff000000
Next
Next
pal(limit) = $ff000000
EndProcedure
Procedure InitPalette1()
Protected i,r,g,b
For i=0 To limit-1
r=Mod(i,32)*7;
g=Mod(i,16)*14;
b=Mod(i,128)*2;
r=r<<16;
g=g<<8;
pal(i)=r+g+b
Next
EndProcedure
Procedure InitPalette2()
Protected i,r,g,b
For i=0 To limit-1
If (i<63):r=i: EndIf
If (i>62 And i<128):g=i: EndIf
If (i>127 And i<192):b=i: EndIf
If (i>191) :r=i/4 :g=r :b=r : EndIf
r=r<<16;
g=g<<8;
pal(i)=r+g+b
Next
EndProcedure
Procedure InitPalette3(n=0)
Protected i,r,g,b
For i=0 To limit-1
If (n=0):r=255*Cos(Radian(i*2)):g=255*Cos(Radian(i*3)):b=255*Cos(Radian(i*4)):EndIf
If (n=1):r=255*Cos(i*3):g=255*Cos(i*4):b=255*Cos(i*2):EndIf
If (n=2):r=255*Cos(i*4):g=255*Cos(i*2):b=255*Cos(i*3):EndIf
If (n=3):r=255*Cos(i*2):g=255*Cos(i*4):b=255*Cos(i*3):EndIf
r=r<<16;
g=g<<8;
pal(i)=r+g+b
Next
EndProcedure
Procedure InitPalette4()
Protected i,r,g,b
For i=0 To limit-1
r=i*8
g=i*4
b=i
pal(i)=r*$10000 + g*$100 +b
Next
EndProcedure
Procedure InitPalette5()
Protected i,r,g,b
For i=0 To limit-1
r=Mod(((i+1)*20),255)
g=Mod(((i+2)*20),255)
b=Mod(((i+3)*20),255)
pal(i)=r<<16 + g<<8 +b
Next
EndProcedure
Procedure mandelbrotx2(a.d,b.d,c.d,d.d,scalecx.d,scalezx.d,Array col.q(1))
Protected cp.q,fo.d,add.q, i,t,co
Protected infinity.f=4
cp=limit
fo=infinity
add=1
co=@col()
!movddup xmm6,[p.v_a];cx
!movddup xmm7,[p.v_b];cy
!movddup xmm0,[p.v_c];zx
!movddup xmm1,[p.v_d];zy
!movddup xmm5,[p.v_fo];
!movddup xmm8,[p.v_add];
!pxor xmm9,xmm9
!movsd xmm3,[p.v_scalecx]
!addsd xmm6,xmm3
!movsd xmm3,[p.v_scalezx]
!addsd xmm0,xmm3
!xor rax,rax
!boucle_i:
!movupd xmm2,xmm0 ; xmm2 = zx
!mulpd xmm0,xmm0 ; xmm0 = zx * zx
!movupd xmm3,xmm1 ; xmm3 = zy
!mulpd xmm3,xmm3 ; xmm3 = zy * zy
!movupd xmm4,xmm3 ; xmm4 = zy * zy
!addpd xmm4,xmm0 ; xmm4 = zy * zy + zx * zx
!cmpltpd xmm4,xmm5
!movmskpd rdx,xmm4
!andpd xmm4,xmm8
!addpd xmm9,xmm4
!cmp rdx,0
!jz fin
!movupd xmm4,xmm2 ; xmm4 = zx
!subpd xmm0,xmm3 ; xmm0 = zx * zx - zx * zx
!addpd xmm0,xmm6 ; xmm2 = zx * zx - zx * zx + cx
!mulpd xmm1,xmm4 ; zx * zy
!addpd xmm1,xmm1 ; zx * zy * 2
!addpd xmm1,xmm7 ; zx * zy * 2 + cy
!inc rax
!cmp rax,[p.v_cp]
!jb boucle_i
!fin:
!mov rax,[p.v_co]
!movdqu [rax],xmm9
EndProcedure
Procedure mandelbrot(num)
Protected i,j,di,dj,jdeb,jfin ,x.d,y.d , zx.d,zy.d , cx.d,cy.d
Dim col.q(2)
jdeb=ey/ndt*num
jfin=ey/ndt*(num+1)
di=pass & 1
dj=pass >>1
For j=jdeb+dj To jfin-1 Step 2
zy=py+(j -ey/2)*scale
zx=px+(di-ex/2)*scale
cy=zy
cx=zx
If position>0
cx=pos(position)\x
cy=pos(position)\y
scalezx = scale*2
scalecx=0
Else
zx=0
zy=0
scalecx = scale*2
scalezx=0
EndIf
For i=di To ex-1 Step 4
mandelbrotx2(cx,cy,zx,zy,scalecx,scalezx,col())
bmp(j,i+0)=pal(col(1))
bmp(j,i+2)=pal(col(0))
If position>0
zx+scale*4
Else
cx+scale*4
EndIf
Next
Next
EndProcedure
InitSprite()
InitKeyboard()
InitMouse()
OpenWindow(0, 0, 0,ex,ey, " Mandelbrot - Use mouse + wheel - LMB to change colors - [F1] Animation (clic to stop) - [Esc] Quit",#PB_Window_ScreenCentered):OpenWindowedScreen(WindowID(0), 0, 0, ex, ey)
;OpenScreen(ex,ey,32,"")
Define rx.d,ry.d,compt.q
rx.d=0
ry.d=0
compt=0
Restore DonneesNumeriques
While rx<>-1 Or ry<>-1
Read.d rx
Read.d ry
pos(compt)\x = rx
pos(compt)\y = ry
compt = compt + 1
If compt>100 : Break : EndIf
Wend
compt = compt - 2
InitPalette()
scale=2/ey
Structure d3
x.d
y.d
z.d
EndStructure
Define auto=0,n,speed.f=0.01,ncible=-1
Dim cible.d3(100)
Macro defcible(vx,vy,vz)
ncible+1
cible(ncible)\x=vx
cible(ncible)\y=vy
cible(ncible)\z=vz
EndMacro
defcible(0,0,scale)
defcible(-1.74824670606330,-0.00000929287120,0.0000000000004)
defcible(-1.47371049186618,-0.00118606043680,0.00000000000402)
defcible(-0.10494709460288,0.92785703871758,0.00000000000002)
defcible(-0.17030719754610,-1.04455558192402,0.00000000000002)
defcible(-1.02351647109090,-0.28038897116474,0.000000000000003)
defcible(-1.24608830915113,-0.32550803613228,0.000000000000072)
defcible(-1.25403231646337,0.38483487689992,0.000000000000183)
defcible(-1.24165790231311,0.32354681010716,0.00000000000001)
defcible(0.39271500274068,-0.36734653571715,0.000000000000044)
defcible(-1.48126951978746,-0.00269131747118,0.00000000000004)
defcible(-1.99909584429894,-0.00000007963938,0.00000000000090)
n=Random(ncible,1)
CreateSprite(0,32,32):StartDrawing(SpriteOutput(0)):LineXY(0,15,31,15,$ffffffff):LineXY(15,0,15,31,$ffffffff):StopDrawing()
MouseLocate(ex/2,ey/2)
Repeat
WindowEvent()
ExamineMouse()
ExamineKeyboard()
If MouseButton(2):InitPalette():cpt=4:EndIf
If MouseButton(3):SetClipboardText("defcible("+StrD(px,14)+","+StrD(py,14)+","+StrD(scale,14)+")"):End:EndIf
ascale=scale
apx=px
apy=py
If auto
If Abs(Log(scale)-Log(cible(n)\z))<0.1:If n:n=0:Else:n=Random(ncible,1):InitPalette():EndIf:Debug n:EndIf
px+(cible(n)\x-px)*speed*1.1
py+(cible(n)\y-py)*speed*1.1
scale+(cible(n)\z-scale)*speed
If MouseButton(1):auto=0:EndIf
Else
x=MouseX()
y=MouseY()
scale=scale*(1-0.1*MouseWheel())
px-(x-ex/2)*(scale-ascale)
py-(y-ey/2)*(scale-ascale)
If MouseButton(1):px-MouseDeltaX()*scale:py-MouseDeltaY()*scale:EndIf
If KeyboardReleased(#PB_Key_F1):auto=1:scale=cible(n)\z:EndIf
If KeyboardReleased(#PB_Key_Q) : position=0: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_W) : position=1: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_E) : position=2: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_R) : position=3: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_T) : position=4: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_Y) : position=5: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_U) : position=6: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_I) : position=7: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_O) : position=8: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_P) : position=9: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_A) : position=10: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_S) : position=11: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_D) : position=12: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_F) : position=13: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_G) : position=14: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_H) : position=15: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_J) : position=16: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_K) : position=17: cpt=4 : EndIf
;If KeyboardReleased(#PB_Key_L) : position=18: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_1) : InitPalette(): cpt=4 : EndIf
If KeyboardReleased(#PB_Key_2) : InitPalette1(): cpt=4 : EndIf
If KeyboardReleased(#PB_Key_3) : InitPalette2(): cpt=4 : EndIf
If KeyboardReleased(#PB_Key_4) : InitPalette3(): cpt=4 : EndIf
If KeyboardReleased(#PB_Key_5) : InitPalette4(): cpt=4 : EndIf
If KeyboardReleased(#PB_Key_6) : InitPalette5(): cpt=4 : EndIf
EndIf
If ascale<>scale Or apx<>px Or apy<>py:cpt=4:EndIf
If cpt
cpt-1
pass=(pass+1) & 3
;t=ElapsedMilliseconds()
For i=0 To ndt-1:Thread(i)=CreateThread(@mandelbrot(),i):Next
For i=0 To ndt-1:If Thread(i) : WaitThread(thread(i)):EndIf:Next
;ndt=1:mandelbrot(0)
;t=ElapsedMilliseconds()-t
EndIf
StartDrawing(ScreenOutput())
CopyMemory(@bmp(0,0),DrawingBuffer(),ex*ey*4)
DrawingMode(#PB_2DDrawing_Transparent )
DrawText(10,10,"Scale " + StrD(scale,14))
DrawText(10,30,"X "+StrD(px,14))
DrawText(10,50,"Y "+StrD(py,14))
;DrawText(10,70,Str(t))
StopDrawing()
DisplayTransparentSprite(0,x-15,y-15)
FlipBuffers()
Until KeyboardReleased(#PB_Key_Escape)
DataSection
DonneesNumeriques:
Data.d 0 , 0
Data.d -0.7927 , 0.32
Data.d 0.32 , 0.43
Data.d -0.7927 , 0
Data.d -0.7927 , 0.1609
Data.d -1 , 0.0005
Data.d -0.4 , 0.6
Data.d 0.285 , 0.5
Data.d 0.285 , 0.01
Data.d -0.70176 , -0.3842
Data.d -0.835 , -0.2321
Data.d -0.8 , 0.156
Data.d -1.18 , 0.18
Data.d -0.75 , 0.1
;Data.d 0.6 , 0.55
;Data.d 0.8 , 0.6
Data.d 0.3 , 0.6
Data.d 0.32 , 0.043
Data.d -0.0986 , 0.65186
Data.d -0.7 , 0.27015
Data.d -1,-1
version 'avx2'
Code : Tout sélectionner
EnableExplicit
Global limit=255,ex=1280,ey=720, i,x,y,z,b,dx,dy,pass=-1,cpt=4,t
Global.d apx,px, apy,py,ascale,scale, scalecx.d , scalezx.d
Global Dim pal.l(limit)
Global Dim Bmp.l(ey - 1, ex - 1)
Global ndt=CountCPUs(#PB_System_ProcessCPUs )
Global Dim Thread(ndt)
Structure posst
x.d
y.d
EndStructure
Global Dim pos.posst(99)
Global position=0
Procedure ColorBlend(color1.l, color2.l, blend.f)
Protected r.w,g.w,b.w,a.w
r= Red(color1) + (Red(color2) - Red(color1)) * blend
g=Green(color1) + (Green(color2) - Green(color1)) * blend
b= Blue(color1) + (Blue(color2) - Blue(color1)) * blend
a=Alpha(color1) + (Alpha(color2) - Alpha(color1)) * blend
ProcedureReturn RGBA(r,g,b,a)
EndProcedure
Procedure InitPalette(n=16,Cont=0)
Protected i,j,c1,c2
c2=Random($ffffff)
For j = 0 To limit/n
If Cont:c1=c2:Else:c1=Random($ffffff):EndIf
c2=Random($ffffff)
For i=0 To n-1
pal(j*n+i) =ColorBlend(c1,c2, i/ n) | $ff000000
Next
Next
pal(limit) = $ff000000
EndProcedure
Procedure InitPalette1()
Protected i,r,g,b
For i=0 To limit-1
r=Mod(i,32)*7;
g=Mod(i,16)*14;
b=Mod(i,128)*2;
r=r<<16;
g=g<<8;
pal(i)=r+g+b
Next
EndProcedure
Procedure InitPalette2()
Protected i,r,g,b
For i=0 To limit-1
If (i<63):r=i: EndIf
If (i>62 And i<128):g=i: EndIf
If (i>127 And i<192):b=i: EndIf
If (i>191) :r=i/4 :g=r :b=r : EndIf
r=r<<16;
g=g<<8;
pal(i)=r+g+b
Next
EndProcedure
Procedure InitPalette3(n=0)
Protected i,r,g,b
For i=0 To limit-1
If (n=0):r=255*Cos(Radian(i*2)):g=255*Cos(Radian(i*3)):b=255*Cos(Radian(i*4)):EndIf
If (n=1):r=255*Cos(i*3):g=255*Cos(i*4):b=255*Cos(i*2):EndIf
If (n=2):r=255*Cos(i*4):g=255*Cos(i*2):b=255*Cos(i*3):EndIf
If (n=3):r=255*Cos(i*2):g=255*Cos(i*4):b=255*Cos(i*3):EndIf
r=r<<16;
g=g<<8;
pal(i)=r+g+b
Next
EndProcedure
Procedure InitPalette4()
Protected i,r,g,b
For i=0 To limit-1
r=i*8
g=i*4
b=i
pal(i)=r*$10000 + g*$100 +b
Next
EndProcedure
Procedure InitPalette5()
Protected i,r,g,b
For i=0 To limit-1
r=Mod(((i+1)*20),255)
g=Mod(((i+2)*20),255)
b=Mod(((i+3)*20),255)
pal(i)=r<<16 + g<<8 +b
Next
EndProcedure
Procedure mandelbrotx4(a.d,b.d,c.d,d.d,scalecx.d,scalezx.d,Array col.q(1))
Protected cp.q,fo.d,add.q, i,tc,tz,co.q
Protected infinity.f=4
Dim tabc.d(4)
Dim tabz.d(4)
cp=limit
fo=infinity
add=1
For i=0 To 3
tabc(i)=a
tabz(i)=c
a+scalecx
c+scalezx
Next
tc=@tabc()
tz=@tabz()
co=@col()
;!VBROADCASTSD ymm6,[p.v_a];cx
!VBROADCASTSD ymm7,[p.v_b];cy
;!VBROADCASTSD ymm0,[p.v_c];zx
!VBROADCASTSD ymm1,[p.v_d];zy
!VBROADCASTSD ymm5,[p.v_fo]; 4 4 4 4
!VBROADCASTSD ymm8,[p.v_add];
!vpxor ymm9,ymm9,ymm9
!mov rdx,[p.v_tc]
!vmovupd ymm6,[rdx]
!mov rdx,[p.v_tz]
!vmovupd ymm0,[rdx]
!xor rax,rax
!boucle_i:
!vmovupd ymm2,ymm0 ; xmm2 = zx
!vmulpd ymm0,ymm0,ymm0 ; xmm0 = zx * zx
!vmovupd ymm3,ymm1 ; xmm3 = zy
!vmulpd ymm3,ymm3,ymm3 ; xmm3 = zy * zy
!vmovupd ymm4,ymm3 ; xmm4 = zy * zy
!vaddpd ymm4,ymm4,ymm0 ; xmm4 = zy * zy + zx * zx
!vcmpltpd ymm4,ymm4,ymm5
!vmovmskpd rdx,ymm4
!vandpd ymm4,ymm4,ymm8
!vaddpd ymm9,ymm9,ymm4
!cmp rdx,0
!jz fin
!vmovupd ymm4,ymm2 ; xmm4 = zx
!vsubpd ymm0,ymm0,ymm3 ; xmm0 = zx * zx - zx * zx
!vaddpd ymm0,ymm0,ymm6 ; xmm2 = zx * zx - zx * zx + cx
!vmulpd ymm1,ymm1,ymm4 ; zx * zy
!vaddpd ymm1,ymm1,ymm1 ; zx * zy * 2
!vaddpd ymm1,ymm1,ymm7 ; zx * zy * 2 + cy
!inc rax
!cmp rax,[p.v_cp]
!jb boucle_i
!fin:
!mov rdx,[p.v_co]
!vMOVDQU [rdx],ymm9
!VZEROALL
EndProcedure
Procedure mandelbrot(num)
Protected i,j,di,dj,jdeb,jfin ,x.d,y.d , zx.d,zy.d , cx.d,cy.d
Dim col.q(4)
jdeb=ey/ndt*num
jfin=ey/ndt*(num+1)
di=pass & 1
dj=pass >>1
For j=jdeb+dj To jfin-1 Step 2
zy=py+(j -ey/2)*scale
zx=px+(di-ex/2)*scale
cy=zy
cx=zx
If position>0
cx=pos(position)\x
cy=pos(position)\y
scalezx = scale*2
scalecx=0
Else
zx=0
zy=0
scalecx = scale*2
scalezx=0
EndIf
For i=di To ex-1 Step 8
mandelbrotx4(cx,cy,zx,zy,scalecx,scalezx,col())
bmp(j,i+0)=pal(col(0))
bmp(j,i+2)=pal(col(1))
bmp(j,i+4)=pal(col(2))
bmp(j,i+6)=pal(col(3))
If position>0
zx+scale*8
Else
cx+scale*8
EndIf
Next
Next
EndProcedure
InitSprite()
InitKeyboard()
InitMouse()
OpenWindow(0, 0, 0,ex,ey, " Mandelbrot - Use mouse + wheel - LMB to change colors - [F1] Animation (clic to stop) - [Esc] Quit",#PB_Window_ScreenCentered):OpenWindowedScreen(WindowID(0), 0, 0, ex, ey)
;OpenScreen(ex,ey,32,"")
Define rx.d,ry.d,compt.q
rx.d=0
ry.d=0
compt=0
Restore DonneesNumeriques
While rx<>-1 Or ry<>-1
Read.d rx
Read.d ry
pos(compt)\x = rx
pos(compt)\y = ry
compt = compt + 1
If compt>100 : Break : EndIf
Wend
compt = compt - 2
InitPalette()
scale=2/ey
Structure d3
x.d
y.d
z.d
EndStructure
Define auto=0,n,speed.f=0.01,ncible=-1
Dim cible.d3(100)
Macro defcible(vx,vy,vz)
ncible+1
cible(ncible)\x=vx
cible(ncible)\y=vy
cible(ncible)\z=vz
EndMacro
defcible(0,0,scale)
defcible(-1.74824670606330,-0.00000929287120,0.0000000000004)
defcible(-1.47371049186618,-0.00118606043680,0.00000000000402)
defcible(-0.10494709460288,0.92785703871758,0.00000000000002)
defcible(-0.17030719754610,-1.04455558192402,0.00000000000002)
defcible(-1.02351647109090,-0.28038897116474,0.000000000000003)
defcible(-1.24608830915113,-0.32550803613228,0.000000000000072)
defcible(-1.25403231646337,0.38483487689992,0.000000000000183)
defcible(-1.24165790231311,0.32354681010716,0.00000000000001)
defcible(0.39271500274068,-0.36734653571715,0.000000000000044)
defcible(-1.48126951978746,-0.00269131747118,0.00000000000004)
defcible(-1.99909584429894,-0.00000007963938,0.00000000000090)
n=Random(ncible,1)
CreateSprite(0,32,32):StartDrawing(SpriteOutput(0)):LineXY(0,15,31,15,$ffffffff):LineXY(15,0,15,31,$ffffffff):StopDrawing()
MouseLocate(ex/2,ey/2)
Repeat
WindowEvent()
ExamineMouse()
ExamineKeyboard()
If MouseButton(2):InitPalette():cpt=4:EndIf
If MouseButton(3):SetClipboardText("defcible("+StrD(px,14)+","+StrD(py,14)+","+StrD(scale,14)+")"):End:EndIf
ascale=scale
apx=px
apy=py
If auto
If Abs(Log(scale)-Log(cible(n)\z))<0.1:If n:n=0:Else:n=Random(ncible,1):InitPalette():EndIf:Debug n:EndIf
px+(cible(n)\x-px)*speed*1.1
py+(cible(n)\y-py)*speed*1.1
scale+(cible(n)\z-scale)*speed
If MouseButton(1):auto=0:EndIf
Else
x=MouseX()
y=MouseY()
scale=scale*(1-0.1*MouseWheel())
px-(x-ex/2)*(scale-ascale)
py-(y-ey/2)*(scale-ascale)
If MouseButton(1):px-MouseDeltaX()*scale:py-MouseDeltaY()*scale:EndIf
If KeyboardReleased(#PB_Key_F1):auto=1:scale=cible(n)\z:EndIf
If KeyboardReleased(#PB_Key_Q) : position=0: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_W) : position=1: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_E) : position=2: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_R) : position=3: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_T) : position=4: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_Y) : position=5: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_U) : position=6: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_I) : position=7: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_O) : position=8: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_P) : position=9: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_A) : position=10: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_S) : position=11: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_D) : position=12: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_F) : position=13: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_G) : position=14: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_H) : position=15: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_J) : position=16: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_K) : position=17: cpt=4 : EndIf
;If KeyboardReleased(#PB_Key_L) : position=18: cpt=4 : EndIf
If KeyboardReleased(#PB_Key_1) : InitPalette(): cpt=4 : EndIf
If KeyboardReleased(#PB_Key_2) : InitPalette1(): cpt=4 : EndIf
If KeyboardReleased(#PB_Key_3) : InitPalette2(): cpt=4 : EndIf
If KeyboardReleased(#PB_Key_4) : InitPalette3(): cpt=4 : EndIf
If KeyboardReleased(#PB_Key_5) : InitPalette4(): cpt=4 : EndIf
If KeyboardReleased(#PB_Key_6) : InitPalette5(): cpt=4 : EndIf
EndIf
If ascale<>scale Or apx<>px Or apy<>py:cpt=4:EndIf
If cpt
cpt-1
pass=(pass+1) & 3
;t=ElapsedMilliseconds()
For i=0 To ndt-1:Thread(i)=CreateThread(@mandelbrot(),i):Next
For i=0 To ndt-1:If Thread(i) : WaitThread(thread(i)):EndIf:Next
;ndt=1:mandelbrot(0)
;t=ElapsedMilliseconds()-t
EndIf
StartDrawing(ScreenOutput())
CopyMemory(@bmp(0,0),DrawingBuffer(),ex*ey*4)
DrawingMode(#PB_2DDrawing_Transparent )
DrawText(10,10,"Scale " + StrD(scale,14))
DrawText(10,30,"X "+StrD(px,14))
DrawText(10,50,"Y "+StrD(py,14))
;DrawText(10,70,Str(t))
StopDrawing()
DisplayTransparentSprite(0,x-15,y-15)
FlipBuffers()
Until KeyboardReleased(#PB_Key_Escape)
DataSection
DonneesNumeriques:
Data.d 0 , 0
Data.d -0.7927 , 0.32
Data.d 0.32 , 0.43
Data.d -0.7927 , 0
Data.d -0.7927 , 0.1609
Data.d -1 , 0.0005
Data.d -0.4 , 0.6
Data.d 0.285 , 0.5
Data.d 0.285 , 0.01
Data.d -0.70176 , -0.3842
Data.d -0.835 , -0.2321
Data.d -0.8 , 0.156
Data.d -1.18 , 0.18
Data.d -0.75 , 0.1
;Data.d 0.6 , 0.55
;Data.d 0.8 , 0.6
Data.d 0.3 , 0.6
Data.d 0.32 , 0.043
Data.d -0.0986 , 0.65186
Data.d -0.7 , 0.27015
Data.d -1,-1