'----------------------------------------- 'QComponents By Preacher / Bizarre Designz '----------------------------------------- 'Sorry for lack of comments, any questions 'can be mailed to: 'e-rovik@online.no 'erlend@rovik.com '----------------------------------------- $TYPECHECK ON Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (uAction As Long,uParam As Long,lpvParam As String,fuWinIni As Long) As Long 'Use of the above: ' SystemParametersInfo 20,0,"wallpaper.bmp", &h1 - Wallpaper ' retval=SystemParametersInfo(97, True, True, 0&) - Declare alt tab not available ' RetVal=SystemParametersInfo(97, False, True, 0&) - Declare alt tab available TYPE QMandel EXTENDS QObject xmin as Double:ymin as Double:xmax As Double:ymax As Double:maxcol as Integer width as integer:height as integer Function GetPixel(p,q) as integer dim i as integer,r as double Dim h as Double,w as Double,m as Double,n as Double Dim v as Double,x as Double,y as Double,z as Double h=(QMandel.xmax-QMandel.xmin)/QMandel.Width v=(QMandel.ymax-QMandel.ymin)/QMandel.Height m=QMandel.xmin+p*h:n=QMandel.ymin+q*v:i=0:x=0:y=0 Do w=x*x:z=y*y:r=w+z:y=2*x*y+n:x=w-z+m:i=i+1 Loop Until (i>QMandel.MaxCol) or (r>4) Result=i END Function CONSTRUCTOR Width=100:Height=100:MaxCol=255:XMin=-2.00:YMin=-1.25:XMax=1.25:YMax=1.25 END CONSTRUCTOR END TYPE TYPE QJulia EXTENDS Qobject angler as double:anglel as double:cr as double:cl as double side as double:bailout as double:maxcol as integer:maxiterations as integer width as integer:height as integer Function GetPixel(x,y) as integer dim x as integer,y as integer dim DistanceX as Double,DistanceY as Double,zr as double,zl as double dim iteration as integer,length as double,a as double,b as double DistanceX = QJulia.Side / QJulia.Width:DistanceY = QJulia.Side / QJulia.Height ZR=X*DistanceX+QJulia.AngleR:ZL=Y*DistanceY+QJulia.AngleL:Iteration = 0 DO A=ZR*ZR:B=ZL*ZL:Length=A+B:ZL=2*ZR*ZL+QJulia.CL:ZR=A-B+QJulia.CR Iteration=Iteration+1 LOOP UNTIL Length>QJulia.BailOut OR Iteration>QJulia.MaxIterations Result=Iteration MOD QJulia.MaxCol END SUB CONSTRUCTOR AngleR=-2:AngleL=-1.25:CR=-1:CL=-.625:Side=2.5:MaxCol=16:BailOut=4:Width=200:Height=100:MaxIterations=255 END CONSTRUCTOR END TYPE TYPE QColRange EXTENDS QObject Col(255) AS INTEGER:ColR(255) AS INTEGER:ColG(255) AS INTEGER:ColB(255) AS INTEGER SUB Set(ci,r,g,b) QColRange.Col(ci)=(B SHL 16) OR (G SHL 8) OR R QColRange.ColR(ci)=R:QColRange.ColG(ci)=G:QColRange.ColB(ci)=B END SUB SUB InvRange(fci,sci) Dim i as integer For i=fci to sci QColRange.Col(i)=((255-QColRange.colb(i)) SHL 16) OR ((255-QColRange.Colg(i)) SHL 8) OR (255-QColRange.Colr(i)) QColRange.colb(i)=255-QColRange.colb(i):QColRange.Colg(i)=255-QColRange.Colg(i) QColRange.Colr(i)=255-QColRange.Colr(i) next i END SUB SUB SetRange(fci,fr,fg,fb,sci,sr,sg,sb) dim i as integer,nr as double,ng as double,nb as double dim df as double,jr as double,jg as double,jb as double if sci>fci then:df=sci-fci:else:df=fci-sci:end if if sr>fr then:jr=(sr-fr)/df:else:jr=(fr-sr)/df:jr=jr-jr-jr:end if if sg>fg then:jg=(sg-fg)/df:else:jg=(fg-sg)/df:jg=jg-jg-jg:end if if sb>fb then:jb=(sb-fb)/df:else:jb=(fb-sb)/df:jb=jb-jb-jb:end if nr=fr:ng=fg:nb=fb for i=fci to sci nr=nr+jr:ng=ng+jg:nb=nb+jb If nr>255 then:nr=255:end if If ng>255 then:ng=255:end if If nb>255 then:nb=255:end if If nr<0 then:nr=0:end if If ng<0 then:ng=0:end if If nb<0 then:nb=0:end if QColRange.ColR(i)=nr:QColRange.ColG(i)=ng:QColRange.ColB(i)=nb QColRange.col(i)=((nb) SHL 16) OR ((ng) SHL 8) OR (nr) next i END SUB END TYPE