{Michael Huang Julia Generator} {$N+} uses winixlt, CRT; type complex =record x:real; i:real; end; const divs=128000; blowup=10; mxc=256; cx=-0.655419795; ci=-0.420380435; var cycle:word; norm:extended; point,npoint:complex; a,b:integer; s : String; Ch : Char; nx,ny : Word; Procedure Trans127( R, G, B : Byte; Shift : Byte ); Var I : Byte; aR,aG,aB : Byte; bR,bG,bB : Byte; Begin bR := R; bG := G; bB := B; For I := 1 to 127 Do Begin Screen.GetCol(I,aR,aG,aB); R := (R + (Shift*aR)) div (shift+1); G := (G + (Shift*aG)) div (shift+1); B := (B + (Shift*aB)) div (shift+1); Screen.SetCol( i+127, R, G, B ); R := bR; G := bG; B := bB; End; End; Procedure DeBar ( X1, Y1, X2, Y2 : Word ); Var I,J : Word; C : Byte; Begin For I := X1 to X2 Do For J := Y1 to Y2 Do Begin C := Screen.GetPix( I, J ); If C > 127 Then C := C-127; Screen.FPix( I, J, C ); Screen.Pix ( I, J, C ); End; End; Procedure TransBar( X1, Y1, X2, Y2 : Word ); Var I,J : Word; C : Byte; Begin For I := X1 to X2 Do For J := Y1 to Y2 Do Begin C := Screen.GetPix( I, J ); Screen.FPix( I, J, C+127 ); Screen.Pix ( I, J, C+127 ); End; End; begin Randomize; Screen.init; Screen.cls(0); S := 'x.pal'; Screen.MakePal(S); Screen.SetCol(0,0,0,0); For B := 0 to 319 do For A := 0 to 199 Do Begin Screen.FPix(B,A,Random(127)+1); { Screen.Pix(B,A,B);} End; Ch := ReadKey; Trans127 ( 54, 20, 21, 1 ); {TransBar ( 1, 30, 127, 60 ); } M.Init; Repeat M.Whre; If (M.X <> M.Lx) or (M.Y <> M.Ly) or (M.Bn <> M.Ob) Then Begin DeBar( M.LX, M.LY, NX, NY ); NX := M.X + 8; If NX > 319 Then NX := 319; NY := M.Y + 8; If NY > 199 Then NY := 199; TransBar ( M.X, M.Y, NX, NY ); End; Until Keypressed; for b:=0 to 199 do begin for a:=0 to 320 do begin norm:=0; cycle:=0; point.x:=(a-160)/divs; point.i:=(b-100)/divs; while (norm<=blowup) and (cycle<=mxc) do begin npoint.x:=(point.x*point.x) - (point.i*point.i) + cx; npoint.i:=2*point.i*point.x+ci; inc(cycle); point.x:=npoint.x; point.i:=npoint.i; norm:= (point.x*point.x)+(point.i*point.i); if norm<0 then norm:=11 else norm:=sqrt( (point.x*point.x)+(point.i*point.i) ); end; Screen.FPix(a,b,(cycle div 2)); Screen.Pix (A, B, ( Cycle Div 2 ) ); If Keypressed Then Begin Ch := ReadKey; If Ch = 'q' Then Begin Screen.Fin; Halt; End; If Ch = 'c' Then Begin Screen.MakePal(S); Screen.OutScr; End; If UpCase(Ch) In ['R','G','B'] Then Begin Screen.ModPal(Ch); Screen.OutScr; Screen.SetCol(0,0,0,0); End; End; end; end; Repeat Ch := ReadKey; Screen.MakePal(S); Screen.OutScr; Until Ch = 'q'; Screen.fin; end.