indexBase 0
include "window.inc"
Def Space 32

Window "Fractal Julia",400,300,0xcf0000
double cRe,cIm,newRe,newIm,oldRe,oldIm,zoom=1,moveX,moveY
int maxIteration =300,x,y,i

cRe = -0.7
cIm =  0.27015


For x=0 To Width
   For y=0 To Height
      newRe = 1.5 * (x-Width*.5) / (.5*zoom*Width) + moveX
      newIm = (y-Height*.5) / (.5*zoom*Height) + moveY
      For i=0 To maxIteration
         oldRe = newRe
	 oldIm = newIm
	 newRe = oldRe * oldRe - oldIm * oldIm +cRe
	 newIm = 2 * oldRe * oldIm + cIm
	 if((newRe * newRe + newIm * newIm) > 4) Then Exit For
      Next
      pixel x, y, ColorHLSToRGB(i,150,i)
   Next
Next

Pause
WinEnd