PDA

View Full Version : My DNS



peter
30-11-2013, 14:12
Hi,


Uses "ui"
#INCLUDE "abc.inc"


DWord hdc, hwnd
hwnd = Canvas_Window("ThinBasic",xMiddle(640),yMiddle(480),640,480)
Canvas_Attach(hwnd,0,%TRUE)
hdc = Canvas_GetDC()
SetHandleDC hdc, hwnd
SetFont 12,28,%FW_BOLD,"times"


Dim ce,cm,newRe,newIm,oldRe,oldIm,zoom,mx,my As Single
Dim imax,x,y,i,width,height As Long


imax = 256
width = 320
height= 240
ce = -.99
cm = 0.27015
zoom = 2


Canvas_Clear 0
DrawText 200,100,"WAIT FOR DNS!", Rgb 255,255,255
Canvas_Redraw


For x=0 To width
For y=0 To height
newRe = 1.5 * (x-width*.5) / (.5*zoom*width) + mx
newIm = (y-height*.5) / (.5*zoom*height) + my
For i=0 To imax
oldRe = newRe
oldIm = newIm
newRe = oldRe * oldRe - oldIm * oldIm +ce
newIm = 2 * oldRe * oldIm + cm
If((newRe * newRe + newIm * newIm) >5) Then Exit For
Next
Canvas_SetPixel x, y, HLS(i*6,25,i*9)
Canvas_SetPixel x+320, y, HLS(i*6,25,i*9)
Canvas_SetPixel x, y+240, HLS(i*6,25,i*9)
Canvas_SetPixel x+320, y+240, HLS(i*6,25,i*9)
Next
Next
Canvas_Redraw
Canvas_WaitKey
Canvas_Window End hwnd




Bigger DNS.


Uses "ui"
#INCLUDE "abc.inc"


DWord hdc, hwnd
hwnd = Canvas_Window("ThinBasic",xMiddle(640),yMiddle(480),640,480)
Canvas_Attach(hwnd,0,%TRUE)
hdc = Canvas_GetDC()
SetHandleDC hdc, hwnd
SetFont 12,28,%FW_BOLD,"times"


Dim ce,cm,newRe,newIm,oldRe,oldIm,zoom,mx,my As Single
Dim imax,x,y,i,width,height As Long


imax = 256
width = 640
height= 480
ce = -.99
cm = 0.27015
zoom = 2


Canvas_Clear 0
DrawText 200,100,"WAIT FOR DNS!", Rgb 255,255,255
Canvas_Redraw


For x=0 To width
For y=0 To height
newRe = 1.5 * (x-width*.5) / (.5*zoom*width) + mx
newIm = (y-height*.5) / (.5*zoom*height) + my
For i=0 To imax
oldRe = newRe
oldIm = newIm
newRe = oldRe * oldRe - oldIm * oldIm +ce
newIm = 2 * oldRe * oldIm + cm
If((newRe * newRe + newIm * newIm) >5) Then Exit For
Next
Canvas_SetPixel x, y, HLS(i*6,25,i*9)
Next
Next
Canvas_Redraw
Canvas_WaitKey
Canvas_Window End hwnd