home *** CD-ROM | disk | FTP | other *** search
/ Komputer for Alle 2003 #3 / K-CD-3-2003.ISO / Fractal Forge / SETUP.EXE / Mandelbrot.pas
Encoding:
Pascal/Delphi Source File  |  2002-05-30  |  50.6 KB  |  1,490 lines

  1. unit Mandelbrot;
  2.  
  3. interface
  4.  
  5. uses
  6.     Windows, SysUtils, Messages, Classes, Graphics, Controls,
  7.     Forms, Dialogs, Graphic, Colors, Math, Complex;//ComplexMathLibrary; //Complex;
  8.  
  9. type
  10.  
  11.     TMandelState = (msRun, msPause, msStopped, msDone, msNone, msSaved, msStopping);
  12.  
  13.   TThreadBounded = class;
  14.  
  15.     TMandelPtr= ^TMandelSet;
  16.     TMandelSet = record
  17.         FVersion      : string[32];
  18.         FImageFile    : string[255];
  19.         FName          : string[32];
  20.         FCentReal     : string[32];
  21.         FCentImag     : string[32];
  22.         FMagnitud      : string[32];
  23.         FAlgo         : string[16];
  24.     FIter         : string[16];
  25.         FOffset       : string[16]; // was FIfGreater
  26.     FWidth         : string[16];
  27.     FHeight     : string[16];
  28.         FAspectR    : string[16];
  29.     FPriority    : string[16];
  30.     FJulia    : boolean;
  31.     FColors        : string[24];
  32.     FBailout    : string[32];
  33.     FRealPert    : string[32];
  34.     FImagPert    : string[32];
  35.         FApplyC    : string[16];
  36.         FFormula    : string[16];
  37.     FComments    : string[255];
  38.     FState    : TMandelState;
  39.     FTime     : string[32];// was FCrono
  40.     FCrono     : string[16]; // was FSteps
  41.         FReserved    : string[16];
  42.   end;
  43.  
  44.     TFormulaF = (ffQuad, ffCube, ffForth, ffEight, ffZed, ffSqSingle, ffLambda, ffZedC, ffSin, ffSinTan, ffSpider, ffMagnetism, ffDoubleTail);
  45.  
  46.     TApplyC = ( Iter, Vepstas, Real, Imag, Sum, IntMod, IntRadiant, Prod, SumI, BioM, Radiant, IterRad );
  47.  
  48.   TMandAlgo = ( maInterp256, maInterp8, maInterpEven, maPlain, maBounded, maBoundedMP, maDraft, maOrbits );
  49.  
  50.   TFilterKind = ( fkNone, fkEdge, fkBumper, fkHeight, fkNoise, fkLines, fkCristals, fkEqColors, fkColorBumper, fkUnsharpMask, fkAverage );
  51.  
  52.   TMandParameters = record
  53.     // init given parameters
  54.     FCentReal: Extended;
  55.     FCentImag: Extended;
  56.     FMagnitud: Extended;
  57.     FIter: Extended;
  58.     FWidth: Integer;
  59.     FHeight: Integer;
  60.     FAspectR: Extended;
  61.     FJulia: Boolean;
  62.     FBailout: Integer;
  63.     FRealPert: Extended;
  64.     FImagPert: Extended;
  65.     FApplyC: TApplyC;
  66.     FFormula: TFormulaf;
  67.     FAlgo: TMandAlgo;
  68.     // init calculated parameters
  69.     FMaxIterVal    : Extended; // max value. Usually equal to FIter but it can be different in some formulas
  70.     FCQuad: Boolean;
  71.     FIncI: Extended;
  72.     FIncR: Extended;
  73.     FMinCR: Extended;
  74.     FMinCI: Extended;
  75.     FExtraPar1: Extended; //was ValItr
  76.     FExtraPar2: Extended;
  77.   end;
  78.  
  79.   TProgrEvent = procedure ( Sender: TObject; var Continue: boolean; Progress: Extended = -1 ) of object;
  80.  
  81.   TMandelInfo = record
  82.     FInsideCount: Cardinal;
  83.     FMin: Extended;
  84.     FMax: Extended; // excluded points inside the Set
  85.   end;
  86.  
  87.   TMandelbrot = class
  88.     private
  89.       Bmp: TBitmap;
  90.       MandelSet: TMandelSet;
  91.       FProdVers: string;
  92.       values: array of Extended;
  93.       FOnProgress: TProgrEvent;
  94.       FTimer: Cardinal;
  95.       FInfo: TMandelInfo;
  96.       FFilter: TFilterKind;
  97.       FPrevFilter: TFilterKind;
  98.       FMndcount: Cardinal;
  99.       FLastTime: Cardinal;
  100.       function Getvalue( x, y : integer ): Extended;
  101.       procedure Orbit;
  102.       function  BorderEqual( ARect: TRect ): extended;
  103.       procedure CalculateBorders( ARect: TRect );
  104.       procedure Enclose( Rect: TRect; BordersDone: boolean);
  105.       function  BordersEqual( x, y, step: integer; Adiacents, Diagonals: boolean; var val: extended ): boolean;
  106.       procedure Draft( Step: integer );
  107.       procedure Interpolate( Step: integer );
  108.       procedure Pass( IsOdd: boolean; Step: integer; Interpolate: boolean );
  109.       procedure FillVal( ARect: TRect; AValue: Extended; ValOnly: boolean );
  110.       procedure Fill(ARect: TRect; AValue: Extended );
  111.       procedure TraceBar( Horizontal: boolean; ARect: Trect; var r1, r2: TRect );
  112.       procedure DrawAll( step: integer );
  113.       procedure SetOnProgress(const Value: TProgrEvent);
  114.       procedure SetTimer(const Value: Cardinal);
  115.       procedure CutBorders(var Rect: TRect);
  116.       function  FilteredValuesToCol( Filter: TFilterKind; Val, ValUp, ValDown, ValLeft, ValRight: extended ): TRGBTriple;
  117.       procedure ResetInfo;
  118.     protected
  119.       FParentThread: TThreadBounded;
  120.       procedure SetParentThread( AThread: TThreadBounded );
  121.       function UpdatePar( AMandelSet: TMandelSet ): boolean;
  122.       function FixParameters: boolean;
  123.     public
  124.       Par: TMandParameters;
  125.       Colors : TColorize;
  126.       constructor Create(ABitmap: TBitmap; const ProdVers: string);
  127.       procedure Prepare( AMandelSet: TMandelSet; AColors: TColorize );
  128.       procedure Render( UpdatingInfo: boolean = true );
  129.       function  AlgMndFlt( CR, CI :Extended ): extended;
  130.       function GetPercentDrawn: Extended;
  131.       procedure UpdateInfo;
  132.       procedure Redraw;
  133.       procedure DoProgress( Progress: Extended = -1 );
  134.       procedure DoFilter( AFilter: TFilterKind; KeepProgr: Boolean = True);
  135.       procedure RestoreFilter;
  136.       procedure StoreFilter;
  137.       procedure MandelSetDefault( var AMandelset: TMandelSet );
  138.       property  Info: TMandelInfo read FInfo;
  139.     published
  140.       property  ProgressTimer: Cardinal read FTimer write SetTimer;
  141.       property  OnProgress: TProgrEvent read FOnProgress write SetOnProgress;
  142.     end;
  143.  
  144.   TThreadBounded = class( TThread )
  145.     private
  146.       FMandelbrot: TMandelbrot;
  147.       FRect: TRect;
  148.       FStop: boolean;
  149.       FLastTime: Cardinal;
  150.       FTimer: Cardinal;
  151.       FCritSec: _RTL_CRITICAL_SECTION;
  152.     protected
  153.       procedure Stop;
  154.     public
  155.       constructor Create( AMandelbrot: TMandelbrot );
  156.       destructor Destroy; override;
  157.       procedure Execute; override;
  158.       procedure DoEvents;
  159. //      property Stopped: boolean read FStop;
  160.     end;
  161.  
  162. implementation
  163.  
  164. {uses
  165.   Main;
  166. }
  167.  
  168. { TThreadBounded }
  169.  
  170. constructor TThreadBounded.Create( AMandelbrot: TMandelbrot );
  171.   begin
  172.   inherited Create( True );
  173.   FreeOnTerminate := False;
  174.   FMandelbrot := AMandelbrot;
  175.   FMandelbrot.SetParentThread( self );
  176.   FStop := False;
  177.   FLastTime := 0;
  178.   FTimer := 500;
  179.   InitializeCriticalSection( FCritSec );
  180.   end;
  181.  
  182. destructor TThreadBounded.Destroy;
  183.   begin
  184.   DeleteCriticalSection( FCritSec );
  185.   inherited;
  186.   end;
  187.  
  188. procedure TThreadBounded.DoEvents;
  189.   var
  190.     Continue: Boolean;
  191.     t: Cardinal;
  192.   begin
  193. //    try
  194.     if assigned( FMandelbrot ) and assigned( FMandelbrot.OnProgress ) then
  195.       begin
  196. //      FMandelbrot.DoProgress;
  197.       t := GetTickCount - FLastTime;
  198.       if t > FTimer then
  199.         begin
  200.         EnterCriticalSection( FCritSec );
  201.           try
  202.           Continue := True;
  203.           FMandelbrot.OnProgress( Self, Continue, FMandelbrot.GetPercentDrawn );
  204.           FLastTime := GetTickCount;
  205.           finally
  206.           LeaveCriticalSection( FCritSec );
  207.           end
  208.         end;
  209.       end;
  210. {    except
  211.     on e: exception do
  212.       begin
  213.       OutputDebugString( PChar( e.message ) );
  214.       Stop;
  215.       end;
  216.     end;
  217. }
  218.   end;
  219.  
  220. procedure TThreadBounded.Execute;
  221.   begin
  222.     try
  223.     FMandelbrot.Enclose( FRect, False );
  224.     finally
  225.     Terminate;
  226.     end;
  227.   end;
  228.  
  229.  
  230. procedure TThreadBounded.Stop;
  231.   begin
  232.   FStop := true;
  233.   end;
  234.  
  235. { TMandelbrot }
  236.  
  237. function TMandelbrot.Getvalue( x, y : integer ): Extended;
  238.   begin
  239.   with Par do
  240.     if ( x >= 0 ) and ( x < FWidth ) and ( y >= 0 ) and ( y < FHeight ) then
  241.       Result := values[ x + y * FWidth ]
  242.     else
  243.       Result := 0;
  244.   end;
  245.  
  246. procedure TMandelbrot.DrawAll( step: integer );
  247.   var
  248.     nv, ky, kx: integer;
  249.     CurrLine :  PRGBArray;
  250.     v: Extended;
  251.     tCol : TRGBTriple;
  252.     kys: boolean;
  253.   begin
  254.   nv := -1;
  255.   with Par do
  256.     for ky := 0 to FHeight - 1 do
  257.       begin
  258.       CurrLine :=  PRGBArray( Bmp.ScanLine[ ky ] );
  259.       kys := ( ( ky mod step ) = 0 );
  260.       for kx := 0 to FWidth - 1 do
  261.         begin
  262.         if step = 1 then
  263.           inc( nv )
  264.         else if ( kx mod step ) = 0 then
  265.           begin
  266.           if kys then
  267.             nv := ky * fwidth + kx
  268.           else
  269.             nv := ( ky div step ) * step * fwidth + kx;
  270.           end;
  271.  
  272.         v := values[ nv ];
  273.         tCol := Colors.FromIterToColor( v );
  274.         SwitchRB( tcol );
  275.         CurrLine[ kx ] := tCol;
  276.         end;
  277.       end;
  278.   end;
  279.  
  280. procedure TMandelbrot.Orbit;
  281.   var
  282.     pcy, step, pcx, maxv: Extended;
  283.     i, kx, ky, nv : integer;
  284.         oldzpr, zpr, zpi: extended;
  285.     v, tmpv: Extended;
  286.   begin
  287.   with Par do
  288.     begin
  289.     maxv := 0;
  290.     step := 1 / ( FMagnitud * FHeight );
  291.     nv := 0;
  292.     for ky := 0 to FHeight - 1 do
  293.       begin
  294.       pcy := ( FHeight shr 1 - ky ) * step + FCentImag;
  295.       for kx := 0 to FWidth - 1 do
  296.         begin
  297.         pcx := ( kx - ( FWidth shr 1 ) ) * step + FCentReal;
  298.         zpr := 0;
  299.         zpi := 0;
  300.         i := 0;
  301.         v := 0;
  302.         while i < FIter do
  303.           begin
  304.           inc(i);
  305.           oldzpr := zpr;
  306.           zpr := zpr*zpr - zpi*zpi + pcx;
  307.           zpi := 2*zpi*oldzpr + pcy;
  308.           tmpv := arctan2( abs( zpi - pcy ), abs( zpr - pcx )  ); // distance
  309.            v := v + tmpv;
  310.           if zpr*zpr + zpi*zpi > FBailout then //4 = 2^2
  311.             break;
  312.           end;
  313.         values[ nv ] := v;
  314.         inc( nv );
  315.         if v > maxv then
  316.           maxv := v;
  317.         end;
  318.       end;
  319.     FMaxIterVal := maxv;
  320.     Colors.MaxIter := round( FMaxIterVal );
  321.     end;
  322.   DrawAll( 1 );
  323.   end;
  324.  
  325. function TMandelbrot.BordersEqual( x, y, step: integer; Adiacents, Diagonals: boolean; var val: extended ): boolean;
  326.   var
  327.     i: Extended;
  328.   begin
  329.   i := 0;
  330.   if Adiacents then
  331.     begin
  332.     i := getvalue( x - step, y );
  333.     Result := ( i > 0 ) and ( i = getvalue( x + step, y ) ) and ( i = getvalue( x, y - step ) ) and ( i = getvalue( x, y + step ) );
  334.     end
  335.   else
  336.     Result := true;
  337.   if Diagonals then
  338.     begin
  339.     i := getvalue( x - step, y - step );
  340.     Result := Result and ( i > 0 ) and ( i = getvalue( x + step, y - step ) ) and ( i = getvalue( x - step, y + step ) ) and ( i = getvalue( x + step, y + step ) );
  341.     end;
  342.   if Result then
  343.     val := i;
  344.   end;
  345.  
  346.  
  347. procedure TMandelbrot.Pass( IsOdd: boolean; Step: integer; Interpolate: boolean );
  348.   var
  349.     my, kx, ky, x, y, nv: integer;
  350.     CurrLine :  PRGBArray;
  351.     v, pcx, pcy: Extended;
  352.     tCol : TRGBTriple;
  353.   begin
  354.   with Par do
  355.     begin
  356.     my := ( FHeight - 1 ) div Step;
  357.     if IsOdd and Interpolate then
  358.       my := my shr 1;
  359.     for ky := 0 to my do
  360.       begin
  361.       y := ky * Step;
  362.       if IsOdd and Interpolate then
  363.         y := y shl 1 + Step;
  364.       if y >= FHeight then
  365.         break;
  366.  
  367.       pcy := ( FHeight shr 1 - y ) * FincI + FCentImag;
  368.       CurrLine :=  PRGBArray( Bmp.ScanLine[ y ] );
  369.       if IsOdd and Interpolate then
  370.         x := Step
  371.       else if not IsOdd xor odd( ky ) then
  372.         x := Step
  373.       else
  374.         x := 0;
  375.       for kx := 0 to ( FWidth - 1 ) div ( Step shl 1 ) do
  376.         begin
  377.         if x >= FWidth then
  378.           break;
  379.         nv := x + y * FWidth;
  380.         if values[ nv ] = 0 then
  381.           begin // da calcolare
  382.           if Interpolate and BordersEqual( x, y, Step, not IsOdd, IsOdd, v ) then
  383.             begin
  384.             if IsOdd then
  385.               tCol := PRGBArray( Bmp.ScanLine[ y - Step ] ) [ x - Step ]
  386.             else
  387.               tCol := CurrLine[ x - Step ];
  388.             end
  389.           else
  390.             begin
  391.             pcx := ( x - ( FWidth shr 1 ) ) * FincR + FCentReal;
  392.             v := AlgMndFlt( pcx, pcy ); //   Mandel(pcx, pcy, max);
  393.             tCol := Colors.FromIterToColor( v );
  394.             SwitchRB( tcol );
  395.             end;
  396.           values[ nv ] := v;
  397.           CurrLine[ x ] := tCol;
  398.           end;
  399.         inc( x, Step shl 1 );
  400.         end;
  401.       end;
  402.     DoProgress;
  403.     end;
  404.   end;
  405.  
  406. procedure TMandelbrot.Draft( Step: integer );
  407.   begin
  408.   Pass( true, Step, false );
  409.   Pass( false, Step, true );
  410.     repeat
  411.     Step := Step shr 1;
  412.     Pass( true, Step, true );
  413.     DoProgress;
  414.     Pass( false, Step, true );
  415.     DoProgress;
  416.     until ( Step <= 8 ) or Application.Terminated;
  417.   DrawAll( 8 );
  418.   end;
  419.  
  420. procedure TMandelbrot.Interpolate( Step: integer );
  421.   begin
  422.   Pass( true, Step, false );
  423.   Pass( false, Step, true );
  424.     repeat
  425.     Step := Step shr 1;
  426.     Pass( true, Step, true );
  427.     Pass( false, Step, true );
  428.     until ( Step = 1 ) or Application.Terminated;
  429.   end;
  430.  
  431. procedure TMandelbrot.Fill( ARect: TRect; AValue: Extended );
  432.   begin
  433.   FillVal( ARect, AValue, false );
  434.   end;
  435.  
  436. procedure TMandelbrot.FillVal( ARect: TRect; AValue: Extended; ValOnly: boolean );
  437.   var
  438.     CurrLineDiff, kx, ky, nv: integer;
  439.     CurrLine :  PRGBArray;
  440.     pcx, pcy, v: Extended;
  441.     tcol: TRGBTriple;
  442.     totalarea, longline: boolean;
  443.   begin
  444.   with ARect do
  445.     begin
  446.     totalarea := ( Left = 0 ) and ( Top = 0 ) and ( Right = Bmp.Width - 1 ) and ( Bottom = Bmp.Height - 1 );
  447.     longline := ( Right - Left > 256 ) or ( Bottom - Top > 256 );
  448.     end;
  449.   with Par do
  450.     begin
  451.     v := AValue;
  452.     CurrLine := PRGBArray( Bmp.ScanLine[ ARect.Top ] );
  453.     if ARect.Top <> ARect.Bottom then
  454.       begin
  455.       CurrLineDiff := integer( Bmp.ScanLine[ ARect.Top + 1 ] ) - integer( CurrLine );
  456.       CurrLine := PRGBArray( integer( CurrLine ) - CurrLineDiff );
  457.       end
  458.     else
  459.       CurrLineDiff := 0;
  460.     if not ValOnly then
  461.       begin
  462.       tcol := Colors.FromIterToColor( Avalue );
  463.       SwitchRB( tcol );
  464.       end;
  465.     for ky := ARect.Top to ARect.Bottom do
  466.       begin
  467.       pcy := ( FHeight shr 1 - ky ) * FincI + FCentImag;
  468.       if not ValOnly then
  469.         CurrLine := PRGBArray( integer( CurrLine ) + CurrLineDiff );
  470.       for kx := ARect.Left to ARect.Right do
  471.         begin
  472.         nv := kx + ky * FWidth;
  473.         if AValue = 0 then
  474.           begin
  475.           pcx := ( kx - ( FWidth shr 1 ) ) * FincR + FCentReal;
  476.           v := AlgMndFlt( pcx, pcy );
  477.           if not ValOnly then
  478.             begin
  479.             tcol := Colors.FromIterToColor( v );
  480.             SwitchRB( tcol );
  481.             end;
  482.           end;
  483.         values[ nv ] := v;
  484.         if not ValOnly then
  485.           CurrLine[ kx ] := tCol;
  486.         end;
  487.       if totalarea then
  488.         DoProgress( ky / ARect.Bottom );
  489.       end;
  490.     if longline then
  491.       DoProgress;
  492.     end;
  493.   end;
  494.  
  495. procedure TMandelbrot.CalculateBorders( ARect: TRect );
  496.   var
  497.     bar: TRect;
  498.   begin
  499.   bar := rect( ARect.Left, ARect.Top, ARect.Right, ARect.Top ); // Top
  500.   Fill( bar, 0 );
  501.   bar := rect( ARect.Left, ARect.Bottom, ARect.Right, ARect.Bottom ); //Bottom
  502.   Fill( bar, 0 );
  503.   bar := rect( ARect.Left, ARect.Top + 1, ARect.Left, ARect.Bottom - 1 ); // left
  504.   Fill( bar, 0 );
  505.   bar := rect( ARect.Right, ARect.Top + 1, ARect.Right, ARect.Bottom - 1 ); // right
  506.   Fill( bar, 0 );
  507.   end;
  508.  
  509. function TMandelbrot.BorderEqual( ARect: TRect ): extended;
  510.   var
  511.     k, nv: integer;
  512.     v: Extended;
  513.   begin
  514.   with Par do
  515.     begin
  516.     Result := 0; // worst condition
  517.     // first check the 4 corners
  518.     nv := ARect.Left + ARect.Top * FWidth;
  519.     v := values[ nv ];
  520.     nv := ARect.Right + ARect.Top * FWidth;
  521.     if v <> values[ nv ] then
  522.       exit;
  523.     nv := ARect.Right + ARect.Bottom * FWidth;
  524.     if v <> values[ nv ] then
  525.       exit;
  526.     nv := ARect.Left + ARect.Bottom * FWidth;
  527.     if v <> values[ nv ] then
  528.       exit;
  529.  
  530.     for k := ARect.Left + 1 to ARect.Right - 1 do
  531.       begin
  532.       nv := k + ARect.Top * FWidth;
  533.       if v <> values[ nv ] then
  534.         exit;
  535.       nv := k + ARect.Bottom * FWidth;
  536.       if v <> values[ nv ] then
  537.         exit;
  538.       end;
  539.  
  540.     for k := ARect.Top + 1 to ARect.Bottom - 1 do
  541.       begin
  542.       nv := ARect.Left + k * FWidth;
  543.       if v <> values[ nv ] then
  544.         exit;
  545.       nv := ARect.Right + k * FWidth;
  546.       if v <> values[ nv ] then
  547.         exit;
  548.       end;
  549.     end;
  550.   Result := v;
  551.   end;
  552.  
  553. procedure TMandelbrot.TraceBar( Horizontal: boolean; ARect: Trect; var r1, r2: TRect );
  554.   var
  555.     Bar: TRect;
  556.   begin
  557.   if Horizontal then
  558.     begin
  559.     Bar.Left := ARect.Left + 1 ;
  560.     Bar.Right := ARect.Right - 1;
  561.     Bar.Top := ( ARect.Bottom + ARect.Top ) shr 1;
  562.     Bar.Bottom := Bar.Top;
  563.  
  564.     r1 := rect( ARect.Left, ARect.Top, ARect.Right, Bar.Bottom );
  565.     r2 := rect( ARect.Left, Bar.Top, ARect.Right, ARect.Bottom );
  566.     end
  567.   else
  568.     begin
  569.     Bar.Left := ( ARect.Right + ARect.Left ) shr 1;
  570.     Bar.Right := Bar.Left;
  571.     Bar.Top := ARect.Top + 1;
  572.     Bar.Bottom := ARect.Bottom - 1;
  573.  
  574.     r1 := rect( ARect.Left, ARect.Top, Bar.Right, ARect.Bottom );
  575.     r2 := rect( Bar.Left, ARect.Top, ARect.Right, ARect.Bottom );
  576.     end;
  577.   FillVal( Bar, 0, False );
  578.   end;
  579.  
  580.  
  581. procedure TMandelbrot.Enclose( Rect: TRect; BordersDone: boolean );
  582.   var
  583.     hr, wr : integer;
  584.     r1, r2: TRect;
  585.     bu: Extended;
  586.   begin
  587.   wr := Rect.Right - rect.Left;
  588.   hr := Rect.Bottom - rect.Top;
  589.  
  590.   if ( wr <= 12 ) and ( hr <= 12 ) then
  591.     begin // too small
  592.     CutBorders( Rect );
  593.     Fill( Rect, 0 );
  594.     exit;
  595.     end;
  596.  
  597.   if not BordersDone then
  598.     CalculateBorders( Rect );
  599.  
  600.   bu := BorderEqual( Rect );
  601.   if ( bu > 0 ) and ( wr < Par.FWidth ) then // skip the first time
  602.     begin // Fill solid
  603.     CutBorders( Rect );
  604.     Fill( Rect, bu );
  605.     exit;
  606.     end;
  607.  
  608.   if ( wr >= 32 ) and ( hr >= 32 ) then
  609.     DoProgress;
  610.  
  611.   TraceBar( ( wr < hr ), Rect, r1, r2 );
  612.   Enclose( r1, true );
  613.   Enclose( r2, true );
  614.   end;
  615.  
  616. procedure TMandelbrot.CutBorders( var Rect: TRect );
  617.   begin
  618.   with Rect do
  619.     begin
  620.     inc( Left );
  621.     inc( Top );
  622.     dec( right );
  623.     dec( bottom );
  624.     end;
  625.   end;
  626.  
  627. procedure TMandelbrot.Prepare( AMandelSet: TMandelSet; AColors: TColorize );
  628.   var
  629.     i: integer;
  630.   begin
  631.   if AMandelSet.FVersion = '' then
  632.     FixParameters
  633.   else
  634.     UpdatePar( AMandelSet );
  635.   if assigned( Bmp ) then
  636.     begin
  637.     SetLength( values, par.FWidth * par.FHeight );
  638.     for i := 0 to high(values) do
  639.       values[i] := 0; // set all to zeros
  640.     Bmp.Width := par.FWidth;
  641.     Bmp.Height := par.FHeight;
  642.     Bmp.PixelFormat := pf24bit;
  643.     end;
  644.   if assigned( AColors ) then
  645.     begin
  646.     Colors := AColors;
  647.     Colors.MaxIter := round( par.fiter );
  648.     end;
  649.   end;
  650.  
  651. procedure TMandelbrot.Render(UpdatingInfo: boolean = true);
  652.   var
  653.     tb1, tb2, tb3, tb4 : TThreadBounded;
  654.     hh, hw: integer;
  655.   begin
  656.   FFilter := fkNone;
  657.   if UpdatingInfo then
  658.     begin
  659.     ResetInfo;
  660.     DoProgress( 0 );
  661.     end;
  662.  
  663.     try
  664.     case par.FAlgo of
  665.       maInterp256:
  666.         begin
  667.         Interpolate( 256 );
  668.         end;
  669.       maInterp8:
  670.         begin
  671.         Interpolate( 8 );
  672.         end;
  673.       maPlain:
  674.         begin
  675.         Fill( rect( 0, 0, par.FWidth - 1, par.FHeight - 1 ), 0 );
  676.         end;
  677.       maInterpEven:
  678.         begin
  679.         Pass( true, 1, false );
  680.         DoProgress;
  681.         Pass( false, 1, true );
  682.         end;
  683.       maOrbits:
  684.         begin
  685.         Orbit;
  686.         end;
  687.       maDraft:
  688.         begin
  689.         Draft( 256 );
  690.         end;
  691.       maBoundedMP:
  692.         begin
  693.         tb1 := TThreadBounded.Create( self );
  694.         tb2 := TThreadBounded.Create( self );
  695.         tb3 := TThreadBounded.Create( self );
  696.         tb4 := TThreadBounded.Create( self );
  697.           try
  698.           hw := par.FWidth div 2;
  699.           hh := par.FHeight div 2;
  700.           tb1.FRect := rect( 0, 0, hw - 1, hh - 1 );
  701.           tb2.FRect := rect( hw, 0, par.FWidth - 1, hh - 1 );
  702.           tb3.FRect := rect( 0, hh, hw - 1, par.FHeight - 1 );
  703.           tb4.FRect := rect( hw, hh, par.FWidth - 1, par.FHeight - 1 );
  704.           tb1.Resume;
  705.           tb2.Resume;
  706.           tb3.Resume;
  707.           tb4.Resume;
  708.           while not ( tb4.Terminated and tb3.Terminated and tb2.Terminated and tb1.Terminated ) do
  709.             begin
  710.             Application.ProcessMessages;
  711.             end;
  712.           finally
  713.           tb1.Free;
  714.           tb2.Free;
  715.           tb3.Free;
  716.           tb4.Free;
  717.           end;
  718.         end
  719.       else  //  maBounded:
  720.         begin
  721.         Enclose( rect( 0, 0, par.FWidth - 1, par.FHeight - 1 ), false );
  722.         end;
  723.       end;
  724.     finally
  725.     FFilter := fkNone;
  726.     if UpdatingInfo then
  727.       begin
  728.       DoProgress( 1 );
  729.       UpdateInfo;
  730.       end;
  731.     end;
  732.   end;
  733.  
  734. constructor TMandelbrot.Create(ABitmap: TBitmap; const ProdVers: string);
  735.   begin
  736.   FProdVers := ProdVers;
  737.   Bmp := ABitmap;
  738.   SetLength( values, 0 ); // mette anche a zero
  739.   MandelSetDefault( Mandelset );
  740.   FTimer := 100;
  741.   FLastTime := 0;
  742.   FParentThread := nil;
  743.   end;
  744.  
  745. function TMandelbrot.AlgMndFlt(CR,CI :extended): Extended;
  746.   var
  747.     mi, Realqv,Sumqv,Imagqv,Realnv,Dprodv,Imagnv,PR,PI: extended;
  748.     MaxItr, Iterv : integer;
  749.     zeta, c, t1, t2: Tcomplex;
  750.   begin
  751.   with Par do
  752.     begin
  753.     mi := FBailout; // MaxVal;
  754.     MaxItr := round( FIter );
  755.     Iterv := MaxItr;
  756.     if FCQuad then
  757.       begin
  758.       PR:=2*CR*CI;
  759.       CR:=CR*CR-CI*CI;
  760.       CI:=PR;
  761.       end;
  762.     PR := par.FRealPert;
  763.     PI := par.FImagPert;
  764.  
  765.     if FJulia then
  766.       begin
  767.       PR := CR;
  768.       PI := CI;
  769.       CR := par.FRealPert;
  770.       CI := par.FImagPert;
  771.       end;
  772.  
  773.     case FFormula of
  774.     ffQuad:
  775.     asm
  776.       mov ECX, Iterv
  777.       mov DX, 4100h       {Flags}
  778.       fld mi           {MaxVal                       R7}
  779.       fld CR               {CR                           R6}
  780.       fld CI               {CI                           R5}
  781.       fld PI               {ZqI                          R4}
  782.       fld st(0)            {DPZ:=ZqI                     R3}
  783.       fmul st(1),st        {ZqI:=ZqI*DPZ                 R3}
  784.       fadd st,st           {DPZ:=DPZ+DPZ                 R3}
  785.       fld PR               {ZqR                          R2}
  786.       fmul st(1),st        {DPZ:=DPZ*ZqR                 R2}
  787.       fmul st,st           {ZqR:=ZqR*ZqR                 R2}
  788.       fadd st,st(4)        {ZqR:=ZqR+CR                  R2}
  789.       fsub st,st(2)        {ZqR:=ZqR-ZqI                 R2}
  790.  
  791.       @@start:
  792.       fld  st(0)           {temp:=ZqR                    R1}
  793.       fmul st(1),st        {ZqR:=ZqR*temp                R1}
  794.       fadd st, st(0)       {temp:=temp+temp              R1}
  795.       fxch st(2)           {temp:=DPZ  DPZ:=temp         R1}
  796.       fadd st, st(4)       {temp:=temp+CI                R1}
  797.       fmul st(2),st        {DPZ:=DPZ*temp                R1}
  798.       fmul st, st          {temp:=temp*temp              R1}
  799.       fst  st(3)           {ZqI:=temp                    R1}
  800.       fadd st, st(1)       {temp:=ZqR+ZqI                R1}
  801.       fcomp st(6)          {temp:=temp-MaxVal            R2}
  802.       fstsw AX             {salva 80x87 cond.code        R2}
  803.       fadd st,st(4)        {ZqR:=ZqR+CR                  R2}
  804.       test AX,DX           {test flag carry e zero       R2}
  805.       fsub st,st(2)        {ZqR:=ZqR-ZqI                 R2}
  806.       loopnz @@start
  807.  
  808.       mov EAX,iterv
  809.       sub EAX,ECX
  810.       mov Iterv,EAX
  811.       fadd st,st(2)
  812.       fsub st,st(4)
  813.       fstp Realqv            {R3}
  814.       fstp DProdv            {R4}
  815.       fstp Imagqv            {R5}
  816.       finit
  817.       @@Fine:
  818.       end;
  819.     {  This is corresponding pascal code
  820.     while ((Itr < MaxItr) and (ZqR+ZqI < MaxVal)) do
  821.       begin
  822.       inc(Itr);
  823.       ZR:=ZqR-ZqI+CR;
  824.       ZI:=DPZ+DPZ+CI;
  825.       ZqI:=ZI*ZI;
  826.       DPZ:=ZR*ZI;
  827.       ZqR:=ZR*ZR;
  828.       end;
  829.     }
  830.  
  831.     ffEight:
  832.     asm
  833.       mov ECX, Iterv
  834.       mov DX, 4100h       {Flags}
  835.       fld mi           {MaxVal                       R7}
  836.       fld CR               {CR                           R6}
  837.       fld CI               {CI                           R5}
  838.       fld PI               {ZI                           R4}
  839.       fld PR               {ZR                           R3}
  840.       fld st(1)            {ZqI:=ZI                      R2}
  841.       fmul st,st           {ZqI:=ZqI*ZqI                 R2}
  842.       fld st(1)            {ZqR:=ZR                      R1}
  843.       fmul st,st           {ZqR:=ZqR*ZqR                 R1}
  844.  
  845.       @@start:
  846.       fld  st(0)           {temp:=ZqR                    R0}
  847.       fsub st,st(2)        {temp:=temp-ZqI               R0}
  848.       fxch st(3)           {temp:=ZR ZR:=temp            R0}
  849.       fmul st,st(4)        {temp:=temp*ZI                R0}
  850.       fadd st, st          {temp:=temp+temp              R0}
  851.       fst  st(4)           {ZI:=temp                     R0}
  852.       fmul st, st          {temp:=temp*temp              R0}
  853.       fstp st(2)           {ZqI:=temp                    R1}
  854.       fld st(2)            {temp:=ZR                     R0}
  855.       fmul st, st          {temp:=temp*temp              R0}
  856.       fst st(1)            {ZqR:=temp                    R0}
  857.       fsub st,st(2)        {temp:=temp-ZqI               R0}
  858.       fxch st(3)           {temp:=ZR ZR:=temp            R0}
  859.       fmul st,st(4)        {temp:=temp*ZI                R0}
  860.       fadd st, st          {temp:=temp+temp              R0}
  861.       fst  st(4)           {ZI:=temp                     R0}
  862.       fmul st, st          {temp:=temp*temp              R0}
  863.       fstp st(2)           {ZqI:=temp                    R1}
  864.       fld st(2)            {temp:=ZR                     R0}
  865.       fmul st, st          {temp:=temp*temp              R0}
  866.       fst st(1)            {ZqR:=temp                    R0}
  867.       fsub st,st(2)        {temp:=temp-ZqI               R0}
  868.       fadd st, st(6)       {temp:=temp+CR                R0}
  869.       fxch st(3)           {temp:=ZR ZR:=temp            R0}
  870.       fmul st,st(4)        {temp:=temp*ZI                R0}
  871.       fadd st, st          {temp:=temp+temp              R0}
  872.       fadd st, st(5)       {temp:=temp+CI                R0}
  873.       fst  st(4)           {ZI:=temp                     R0}
  874.       fmul st, st          {temp:=temp*temp              R0}
  875.       fstp st(2)           {ZqI:=temp                    R1}
  876.       fld st(2)            {temp:=ZR                     R0}
  877.       fmul st, st          {temp:=temp*temp              R0}
  878.       fst st(1)            {ZqR:=temp                    R0}
  879.  
  880.       fadd st, st(2)       {temp:=temp+ZqI               R0}
  881.       fcomp st(7)          {temp:=temp-MaxVal            R1}
  882.       fstsw AX             {salva 80x87 cond.code        R1}
  883.       test AX,DX           {test flag carry e zero       R1}
  884.  
  885.       loopnz @@start2
  886.       jp @@cont
  887.   @@start2:      jp @@start
  888.   @@cont:        mov EAX,iterv
  889.       sub EAX,ECX
  890.       mov Iterv,EAX
  891.       fstp Realqv            {R3}
  892.       fstp DProdv             {R4}
  893.       fstp Imagqv            {R5}
  894.       finit
  895.       @@Fine:
  896.       end;
  897.  
  898.     ffForth:
  899.       asm
  900.         mov ECX, Iterv
  901.         mov DX, 4100h       {Flags}
  902.         fld mi               {MaxVal                       R7}
  903.         fld CR               {CR                           R6}
  904.         fld CI               {CI                           R5}
  905.         fld PR               {PZ:=ZR                       R4}
  906.         fld PI               {ZqI:=ZI                      R3}
  907.         fld st(1)            {ZqR:=PZ                      R2}
  908.         fmul st,st           {ZqR:=ZqR*ZqR                 R2}
  909.         fxch st(1)           {ZqR:=ZqI  ZqI:=ZqR           R2}
  910.         fmul st(2),st        {PZ:=ZqR*PZ                   R2}
  911.         fmul st,st           {ZqR:=ZqR*ZqR                 R2}
  912.         fxch st(1)           {ZqR:=ZqI  ZqI:=ZqR           R2}
  913.  
  914.       @@start:
  915.         fld st(0)            {temp:=ZqR                    R1}
  916.         fsub st,st(2)        {temp:=ZqR-ZqI                R1}
  917.         fld st(3)            {tem2:=PZ                     R0}
  918.         fadd st,st           {tem2:=tem2+tem2              R0}
  919.         fadd st,st           {tem2:=tem2+tem2              R0}
  920.         fmul st(4),st        {PZ:=PZ*tem2                  R0}
  921.         fmul st,st(1)        {tem2:=tem2*temp              R0}
  922.         fadd st,st(5)        {tem2:=tem2+CI                R0}
  923.         fstp st(2)           {ZqR:=tem2                    R1}
  924.         fmul st,st           {temp:=temp*temp              R1}
  925.         fsub st,st(3)        {temp:=temp-PZ                R1}
  926.         fadd st,st(5)        {temp:=temp+CR                R1}
  927.         fst st(3)            {PZ:=temp                     R1}
  928.         fmul st,st(1)        {temp:=temp*ZqR               R1}
  929.         fxch st(3)           {temp:=PZ PZ:=temp            R1}
  930.         fmul st,st           {temp:=temp*temp              R1}
  931.         fxch st(1)           {emp*temp      R1}t   R1}t:         R1}
  932.         fxch st(1)           {emp*temp      R1}t   R1}t:         R1}
  933.         fxch st(1)           {emp*temp stp Imagqv      {emp*temp stp Imagqv      {emp*temp stp Imagqv      {emp*temp stp Imagqv      {emp*temp stp Imagqv      {emp*temp stp Imagqv      {emp*temp stp Imagqv      {emp*temp stp Imagqv      {emp*temp stp Imagqv      {emp*temp stp Imagqv      {emp*temp stp Imagqv    )       agqv      {emp*temp stt(4)      k-------gqv      {e4mr+      agqvf     {emp*temp stp Iation GetPe6emp stp Ima
  934. l x, tp ImagT1}
  935.  mnmeRprw    mD   R1}
  936.       test AXstp mag
  937. l x, tp ImagT1}
  938.             {CR                           R6}
  939.         fld CI               {t, st(6)       {temp:   {R3}
  940.       fstp DProdv    t           {temp:=temp*temp         end;
  941.     }
  942.  
  943.     ffEight:t         {PZ:=ZR                       R4}
  944.         fld P}
  945.       fstp DProdv =ZqI  ZqI:=ZqR          0tem2              R0}1)           {ZqR:=ZqI  ZqI:=ZqR          2                  R0            R0}
  946.       fadd st  {Phs     fstp DProdv        -   R1}
  947.         fadd s=ZqI  ZqI:=ZqR          2                  R0   R
  948.         fadd s=ZqI  ZqI:=ZqRPZ:=PZ*tem3                  R0}
  949. R
  950.         fadd s=ZqI  ZqI:=ZqR          6tem2              R0}
  951.         fadd st,s            {temp:=ZZqI            R      R0}
  952.         fmul st(4),st        {
  953.       fstp Imagqv        R6}
  954.       fld CI               {CZqR          0tem2              R0}1)           {ZqR:=ZqI  ZqI:=ZqR          2                  R0   R
  955.         fadd s=ZqI  ZqI:=ZqRtem2:=PZ  2                  R0-           R0}
  956.       fadd st  {t, st          {temp:=temp*temp              R0}
  957.       fstp   {tem2:=tem2+tem2              R0}
  958.         fld st(0)            {test          {tempp:=temp*temp              R0}
  959.       fst s  {temp:=temp*temp             {ZqR             R0}
  960.       fst s  {temp:=Z                I     R0}
  961.         fmul st(4),st        {
  962.     6)       {temp:=temp+CR                R0}
  963.       fxch   {temp:=temp*temp             R*CR                R0)            {test  2 R1}
  964.       test AXR:=temp            R0}
  965.       fmul   {temp:=temp+CR                R1}
  966.         fst st(3)0           {PZ:=temp     {temp:=temp+CI                R0}
  967.       fst  stst(4)           {ZI:=temp                     R0}
  968.       fmul stst, st          {temp:=temp*temp              R0}
  969.       f {temp:={temp:=temp*temp              R1}
  970.         fxch st(1)           {emp*temp      R1}t   R1}t         R1}
  971.  {      fadd st,           {emp*t     fxch st(1)  :         R1}
  972.      R1}t   R)          {emp*temp stp Imagqv      {eZ  tb4.FRectest AX,DX    Info.Xbegin
  973. ;X,DX    Info.Ybegin        R2Vers := Pep;
  974.     is fkN:= ep;
  975.     ir      = Pep;
  976.     ii      = ep;
  977.     idating = ep;
  978.     i,st(4) ors    v kx, ky, ended;
  979. s fkN:<tp I)hr 1;
  980.     for ky := 0 to my do       v        tb2.Info = PZPoweDifInfo;
  981. Info         tb2.Info.0;
  982.  Info.0ro       R2}2.Info.y;
  983.  Info.yb st,st(2)   ii      =  Info.y*Info.yt,st(2)   ir      = PInfo.0*Info.    maxv := s fkN:= ii      +ir            tb2.Resume;
  984.                {eing[16];tb4.FRectest AX,DX    Info.Xbegin
  985. ;X,DX    Info.Ybegin        R2c.Xbegio       R2}c.YbegiC        R2Vers := Pep;
  986.     is fkN:= 1p;
  987.     ir      = Pep;
  988.     ii      = ep;
  989.     idating = ep;
  990.     i,st(4) ors    v kx, ky, ended;
  991. s fkN:<tp I)hr 1;
  992.     for ky := 0 to my do       v        tb2.Info = PZA
  993.   wZSqDifInfoesumInfo;
  994. al;
  995.         z      =  Info.y*Info.yt,st(2)   ir      = PInfo.0*Info.    maxv := s fkN:= ii      +ir            tb2.Resume;
  996.                {eFAspectb4.FRectest AX,DX    Info.Xbegi0.5+n
  997. ;X,DX    Info.Ybegi0+n        R2c.Xbegio       R2}c.YbegiC        R2Vers := Pep;
  998.     is fkN:= ep;
  999.     ir      = Pep;
  1000.     ii      = ep;
  1001.     i,st(4) ors    v kx, ky, ended;
  1002. s fkN:<tp I)hr 1;
  1003.     for ky := 0 to my do       v        tb2.Info = PZMul(PZMul(cumInfosumZSub();
  1004. ZSqDifInfoesogress;
  1005.       z      =  Info.y*Info.yt,st(2)   ir      = PInfo.0*Info.    maxv := s fkN:= ii      +ir            tb2.Resume;
  1006.                {eJulia    : botb4.FRectest AX,DX    Info.Xbegin
  1007. ;X,DX    Info.Ybegin        R2c.Xbegio       R2}c.YbegiC        R2t1 = PZPoweDicum0.15     0.15conda R) e 1;lia     t bo      R2Vers := Pep;
  1008.     is fkN:= ep;
  1009.     ir      = Pep;
  1010.     ii      = ep;
  1011.     i,st(4) ors    v kx, ky, ended;
  1012. s fkN:<tp I)hr 1;
  1013.     for ky := 0 to my do       v        tb2.Info = PZA
  1014.   wZMul(PZSqDiInfosumtResum
  1015. al;
  1016.         z      =  Info.y*Info.yt,st(2)   ir      = PInfo.0*Info.    maxv := s fkN:= ii      +ir            tb2.Resume;
  1017.                {e strtb4.FRectest AX,DX    Info.Xbegin
  1018. ;X,DX    Info.Ybegin        R2c.Xbegio       R2}c.YbegiC        R2Vers := Pep;
  1019.     is fkN:= ep;
  1020.     ir      = Pep;
  1021.     ii      = ep;
  1022.     i,st(4) ors    v kx, ky, ended;
  1023. s fkN:<tp I)hr 1;
  1024.     for ky := 0 to my do       v        tb2.Info = PZPoweDicumInfos;
  1025.         z      =  Info.y*Info.yt,st(2)   ir      = PInfo.0*Info.    maxv := s fkN:= ii      +ir            tb2.Resume;
  1026.                {eSter := rounest AX,DX    Info.XbegiCR+n
  1027. ;X,DX    Info.YbegiCI+n        R2c.Xbegio       R2}c.YbegiC        R2Vers := Pep;
  1028.     is fkN:= ep;
  1029.     ir      = Pep;
  1030.     ii      = ep;
  1031.     i,st(4) ors    v kx, ky, ended;
  1032. s fkN:<tp I)hr 1;
  1033.     for ky := 0 to my do       v        tb2.Info = PZMul(PZSteiInfosumcs;
  1034.         z      =  Info.y*Info.yt,st(2)   ir      = PInfo.0*Info.    maxv := s fkN:= ii      +ir            tb2.Resume;
  1035.                {eSteTaer := rounest AX,DX    Info.XbegiCR+n
  1036. ;X,DX    Info.YbegiCI+n        R2c.Xbegio       R2}c.YbegiC        R2Vers := Pep;
  1037.     is fkN:= ep;
  1038.     ir      = Pep;
  1039.     ii      = ep;
  1040.     i,st(4) ors    v kx, ky, ended;
  1041. s fkN:<tp I)hr 1;
  1042.     for ky := 0:= False  Z<-C*(steiZ+taeiZ))) 0 to my do       v        tb2.Info = PZMul(PC,PZSteiPZA
  1043.   wZnfo;
  1044. ZTae wZnfoesogreal;
  1045.         z      =  Info.y*Info.yt,st(2)   ir      = PInfo.0*Info.    maxv := s fkN:= ii      +ir            tb2.Resume;
  1046.                {eSpidertb4.FRectest AX,DX    Info.Xbegin
  1047. ;X,DX    Info.Ybegin        R2c.Xbegio       R2}c.YbegiC        R2Vers := Pep;
  1048.     iz      =  ep;
  1049.     ir      = Pep;
  1050.     is fkN:= iep;
  1051.     i,st(4) ors    v kx, ky, ended;
  1052. s fkN:<tp I)hr 1;
  1053.     for ky := 0 to my do       v        tb2.Info = PZA
  1054.   wc
  1055. ZSqDifInfoesog       tb2.c = PZA
  1056.   Info;
  1057. ZDiv wc
  1058. 2 )l;
  1059.         z      =  Info.y*Info.yt,st(2)   ir      = PInfo.0*Info.    maxv := s fkN:= ii      +ir            tb2.Resume;
  1060.                {e
  1061.    etismtb4.FRectest AX,DX    Info.Xbegin
  1062. ;X,DX    Info.Ybegin        R2c.Xbegio       R2}c.YbegiC        R2Vers := Pep;
  1063.     iz      =  ep;
  1064.     ir      = Pep;
  1065.     is fkN:= iep;
  1066.     i,st(4) ors    v kx, ky, ended;
  1067. s fkN:<tp I)hr 1;
  1068.     for ky := 0 to my do       v        tb2.t1 = PZSqDifZA
  1069.   wZA
  1070.   wc
  1071. ZSqDifInfoesog, -1sog       tb2.t2 = PZSqDifZA
  1072.   wZA
  1073.   wc
  1074. Info;
  1075. Info  , -2)         tb2.Info = PZDiv w    enal;
  1076.         z      =  Info.y*Info.yt,st(2)   ir      = PInfo.0*Info.    maxv := s fkN:= ii      +ir            tb2.Resume;
  1077.                  {xten        s fkN:= ir      +ii             if U:= ir      -ii      +io       ifo th:= idating +iC    d := nil;
  1078. i   v kx, ky, 
  1079.  
  1080. function TMandelbrot.A extendeeighyCar.FWidth;
  1081.   R2Vers:FWidth;
  1082.   R2         hh := par.FHft + 1 to     v.FRect := rect( 0, 0, hw - 1, hVepstas:FWidth;
  1083.   R2         hh := par.FHft + 1 to i   v +not ExtraParmp.SLe wLe ws fkN:    0.5n
  1084.      ExtraPar2itmap ExtraParmpto Le wLe wagqv, for kx 
  1085.       ExtraPar2 dth + Le w2eate( self );
  1086. t( 0, 0, hw - 1, hSum:  FWidth;
  1087.   R2         hh := par.FHft + 1to sqrt ws fkN:     ExtraParm;magqExtraParm ProdVer + bfor kx}e( self );
  1088. t( 0, 0, hw - 1, h    :FWidth;
  1089.   R2         hh := par.FHft + 1= ii         ExtraParm;mgqExtraParm ProdVer + bfor kx ^ 2}e( self );
  1090. t( 0, 0, hw - 1, h  if: FWidth;
  1091.   R2         hh := par.FHft + 1to r         ExtraParm;magqExtraParm ProdVer + bfor kx ^ 2}e( self );
  1092. t( 0, 0, hw - 1, h    : FWidth;
  1093.   R2         hh := par.FHft + 1to sqrt ws fkN:     ExtraParm       v.r.FHgqExtraParm P1 + bfor kx}e( self );
  1094. t( 0, 0, hw - 1, hSumI: FWidth;
  1095.   R2         hh := par.FHft + 1to    v  notsqrt ws fkN:     ExtraParm );.FHgqExtraParm P1 + bfor kx}e( self );
  1096. t( 0, 0, hw - 1, hBioM:FWidth;
  1097.   R2         hh := par.FH;
  1098.  r      <tp )begin(i      <tp )b
  1099.       if IsOdd and ft + 1 to     ve( self );
  1100. t( ) then
  1101.         x :ft + 1 to 1te( self );
  1102. t( 0, 0, hw - 1, hRadiant:FWidth;
  1103.   R2         hh := par.FHft + 1 to (   nv := 0ifo th, r   Real ap ExtraParmp +n0.5n
  1104. *ProdVerstmap ExtraParmp= pi
  1105. *P2e( self );
  1106. t( 0, 0, hw - 1, h    Rad:FWidth;
  1107.   R2         hh := par.FHft + 1 to     v +not  nv := 0ifo th, r   Real ap ExtraParmp +n0.5n
  1108. stmap ExtraParmp= pi
  1109. *P2hh := par.FHe( self );
  1110. t( 0,      tb2.R) then
  1111.        ft + 1 to rodVers;
  1112.   B
  1113. t( 0, 0, hw - rea := ( Left = 0 ) aTMandelbrot.A extendeeighyCar.FWidth;
  1114.   R2VntMod:FWidth;
  1115.   R2         hh := par.FHrt + 1 to sqrt ws fkN:     ExtraParm;mgqExtraParm ProdVer + bfor kx}e( self );
  1116. t( 0, 0, hw - 1, h ntRadiant:FWidth;
  1117.   R2         hh := par.FHft + 1 to (   nv := 0ifo th, r   Real ap ExtraParmp +n0.5n
  1118. *ProdVerstmap ExtraParmp= pi
  1119. *P2e( self );
  1120. t( 0,      tb2.R) then
  1121.        ft + 1 to rodVers;
  1122.   B
  1123. t( 0, 0, hw - reaom );
  1124.     end;
  1125.  ft + 1 <  end
  1126.     elsft + 1 to 1e-1ep;
  1127.    ;
  1128.  magqv    R)    TRectemlors.re some errdelSin rothqv            
  1129.  
  1130.     r1  par.FHeight - 1 ), f2 ) then
  1131. kip the first time
  1132.   ):= Step shr 1;
  1133.     Pass( tru     else 1;
  1134.     nterpEvenagqv,      tc    enrToFloa    (
  1135.       tcdatingInfo: agqv,            enrToFloa    (
  1136.         datingInfo: agqv,
  1137.            enrToFloa d  (
  1138.  
  1139.        ,and tb2.Teragqv,R   tb4.enrToFloa    (
  1140. R   ,antingInfo: agqv,t do
  1141.    enrTo nt   (
  1142. t do
  1143. datingInfo: 
  1144.  agqv,t do
  1145. <in
  1146.  
  1147.       if Isagqv,t do
  1148.    32gInfo: agqv, );
  1149.     ienrTo nt   (
  1150.  );
  1151.  datingInfo: 
  1152.  agqv, );
  1153.   <in
  1154.  
  1155.       if Isagqv, );
  1156.     i32gInfo: agqv,AspectRtb4.enrToFloa    (
  1157. AspectR,and tb2.Teragqv, end;
  1158. ABit end;tb2.Teragqv, for kx   ienrTo nt   (
  1159.  for kx, 4d tb2.Teragqv,    mi, tb4.enrToFloa    (
  1160.     mi, datingInfo: agqv,Realnv,Dtb4.enrToFloa    (
  1161. Realnv,DdatingInInfo: 
  1162.  Fa= pa= 'gin
  1163.     Co256' 
  1164.  
  1165. function TMandelbrot.Aidth := paFIter   Bmp.He 0, hw - rea := ( Left 
  1166.  Fa= pa= 'gin
  1167.     Co8' 
  1168.  
  1169. function TMandelbrot.Aidth := paFIter   Bmp8 0, hw - rea := ( Left 
  1170.  Fa= pa= 'gin
  1171.     Co2' 
  1172.  
  1173. function TMandelbrot.Aidth := paFIter   Bmp
  1174.     0, hw - rea := ( Left 
  1175.  Fa= pa= 'axIte' 
  1176.  
  1177. function TMandelbrot.Aidth := paFIteraxIte 0, hw - rea := ( Left 
  1178.  Fa= pa= '    Re' 
  1179.  
  1180. function TMandelbrot.Aidth := paFIter    Re 0, hw - rea := ( Left 
  1181.  Fa= pa= 'erp25' 
  1182.  
  1183. function TMandelbrot.Aidth := paFItererp25 0, hw - rea := ( Left 
  1184.  Fa= pa= '     sMP' 
  1185.  
  1186. function TMandelbrot.Aidth := paFIterpolate( 2 0, hw - rea := ( Left FHei  end
  1187. unction TMandelbrot.Aidth := paFIterpolate(ume;
  1188.                  
  1189.  FeighyC='R.^2+I.^2 (mod)'
  1190.  
  1191.       if Isagqv,eighyCab4.eum := ( Left 
  1192.  FeighyC='Pot   ial'
  1193.  
  1194.       if Isagqv,eighyCab4.Vepstas := ( Left 
  1195.  FeighyC='R   ar.FHes*mod'  end;
  1196.  endlegacy   if Isagqv,eighyCab4.     := ( Left 
  1197.  FeighyC='R   a.FHes*mod'  end   if Isagqv,eighyCab4.     := ( Left 
  1198.  FeighyC='R   ar.FHes+mod'  end;
  1199.  endlegacy   if Isagqv,eighyCab4.SumI := ( Left 
  1200.  FeighyC='R   a.FHes+mod'  end   if Isagqv,eighyCab4.SumI := ( Left 
  1201.  FeighyC='    ^2'  end   if Isagqv,eighyCab4.     := ( Left 
  1202.  FeighyC='Realinary^2'  end   if Isagqv,eighyCab4.Real := ( Left 
  1203.  FeighyC='R  Bmntc mod'  end   if Isagqv,eighyCab4.VntMod := ( Left 
  1204.  FeighyC='R  Bmntc radiant'  end   if Isagqv,eighyCab4.VntRadiant := ( Left 
  1205.  FeighyC='Biomorph'  end   if Isagqv,eighyCab4.BioM := ( Left 
  1206.  FeighyC=' adiant'  end   if Isagqv,eighyCab4.Radiant := ( Left 
  1207.  FeighyC='Radiant+R   '  end   if Isagqv,eighyCab4.V   Rad := ( Left = 0 ) aagqv,eighyCab4.V   gInInfo: 
  1208.  Fd;
  1209.    ='Z<-Z^4+C' 
  1210.  
  1211. function TMandelbrot.Aidth = ABi:=e;
  1212.  ;elbrot.Aidth d;
  1213.    :=e    R0 0, hw - rea := ( Left 
  1214.  Fd;
  1215.    ='Z<-Z^3+C' 
  1216.  
  1217. function TMandelbrot.Aidth = ABi:=e;
  1218.  ;elbrot.Aidth d;
  1219.    :=e mp*t 0, hw - rea := ( Left 
  1220.  Fd;
  1221.    ='Z<-Z^2+C^2' 
  1222.  
  1223. function TMandelbrot.Aidth = ABi:=Val := maot.Aidth d;
  1224.    :=e  ABi 0, hw - rea := ( Left 
  1225.  Fd;
  1226.    ='Z<-Z^3+C^2' 
  1227.  
  1228. function TMandelbrot.Aidth = ABi:=Val := maot.Aidth d;
  1229.    :=e mp*t 0, hw - rea := ( Left 
  1230.  Fd;
  1231.    ='Z<-Z^8+C' 
  1232.  
  1233. function TMandelbrot.Aidth = ABi:=e;
  1234.  ;elbrot.Aidth d;
  1235.    :=e E );
  1236.     de- rea := ( Left 
  1237.  Fd;
  1238.    ='Z<-Z^Z+C' 
  1239.  
  1240. function TMandelbrot.Aidth = ABi:=e;
  1241.  ;elbrot.Aidth d;
  1242.    :=e Zei 0, hw - rea := ( Left 
  1243.  Fd;
  1244.    ='Z<-Z^2+Z+C' 
  1245.  
  1246. function TMandelbrot.Aidth = ABi:=e;
  1247.  ;elbrot.Aidth d;
  1248.    :=e ing[16]; 0, hw - rea := ( Left 
  1249.  Fd;
  1250.    ='Z<-Z^C' 
  1251.  
  1252. function TMandelbrot.Aidth = ABi:=e;
  1253.  ;elbrot.Aidth d;
  1254.    :=e ZeiC 0, hw - rea := ( Left 
  1255.  Fd;
  1256.    ='Z<-Z*C*(1-Z)' 
  1257.  
  1258. function TMandelbrot.Aidth = ABi:=e;
  1259.  ;elbrot.Aidth d;
  1260.    :=e FAspec 0, hw - rea := ( Left 
  1261.  Fd;
  1262.    ='Z<-steiZ)+C' 
  1263.  
  1264. function TMandelbrot.Aidth = ABi:=e;
  1265.  ;elbrot.Aidth d;
  1266.    :=e ite 0, hw - rea := ( Left 
  1267.  Fd;
  1268.    ='Z<-C*(siZ+tiZ)))'  end;
  1269. Z<-C*(steiZ+taeiZ))) 0 to myTMandelbrot.Aidth = ABi:=e;
  1270.  ;elbrot.Aidth d;
  1271.    :=e iteTae 0, hw - rea := ( Left 
  1272.  Fd;
  1273.    ='Spider' 
  1274.  
  1275. function TMandelbrot.Aidth = ABi:=e;
  1276.  ;elbrot.Aidth d;
  1277.    :=e ipider 0, hw - rea := ( Left 
  1278.  Fd;
  1279.    ='
  1280.    etism' 
  1281.  
  1282. function TMandelbrot.Aidth = ABi:=e;
  1283.  ;elbrot.Aidth d;
  1284.    :=e 
  1285.    etism 0, hw - rea := ( Left 
  1286.  Fd;
  1287.    ='Julia    : bo' 
  1288.  
  1289. function TMandelbrot.Aidth = ABi:=e;
  1290.  ;elbrot.Aidth d;
  1291.    :=e Julia    : bo 0, hw - rea := ( Left = 0 ) aTMandelbrot.Aidth d;
  1292.    :=e  ABi 0, hw - idth = ABi:=e;
  1293.  ;elbrot.Areaom );
  1294.   DoProgreb2.F time
  1295.       elsft + 1 to  ( wr >= 32 )om );
  1296.  xcept := ( 2 ) then
  1297.       else  //  mlsft + 1 to e;
  1298.  ;elbrot
  1299.             be par.FHeight - 1 ), f ( wr >= 32 ):= Step shr 1;
  1300.     Pass( trpuctor TMandnterpEv    xtendeeighyCar.FWidthSum: = 0 ) aTMandelbrot.A ExtraParmpto ,R   t/itmap: TBielbrot.Areaom );
  1301. Vepstas:FWidth;
  1302. TMandelbrot.A ExtraParmpto Le wLe w, for kx 
  1303.  ;elbrot.A ExtraPar2 = Ph + Le w2eate( self  );
  1304.   FTim   :  FWidth;
  1305. TMandelbrot.A ExtraParmpto 1t/itmap: TBielbrot.Areaom );
  1306. SumI:FWidth;
  1307. TMandelbrot.A ExtraParmpto 1t/itmap: TBielbrot.Areaom );
  1308.   if: = 0 ) aTMandelbrot.A ExtraParmpto ,R   t/i w, for kx *w, for kx 
  1309. ielbrot.Areaom );
  1310.     :FWidth;
  1311. TMandelbrot.A ExtraParmpto ,R   t/i w, for kx *w, for kx 
  1312. ielbrot.Areaom );
  1313.  ntMod:FWidth;
  1314. TMandelbrot.A ExtraParmpto ,R   t/itmap: TBielbrot.Areaom );
  1315.  ntRadiant:FWidth;
  1316. TMandelbrot.A ExtraParmpto pi
  1317. *P2ielbrot.Areaom );
  1318. BioM:FWidth;
  1319. TMandelbrot.A ExtraParmpto ,R   t/itmap: TBielbrot.Areaom );
  1320. Radiant:FWidth;
  1321. TMandelbrot.A ExtraParmpto pi
  1322. *P2ielbrot.Areaom );
  1323.     Rad:  FWidth;
  1324. TMandelbrot.A ExtraParmpto pi
  1325. *P2ielbrot.Areaom );
  1326. Left = 0 ) a ExtraParmpto 0;elbrot
  1327.     FWidth;
  1328. FHe)    c rect( Bdrpuc>= 32 ) and 
  1329.  
  1330.  ColorVal    to ,R       tbaxree;
  1331. . Ususume eect.  be,R   tbkx    c n
  1332. TM diffee( rSin some f;
  1333.    ) and 
  1334. IARecto 1t/i(
  1335.  
  1336.         *w, r2, true );
  1337.  
  1338. IARRpto ,RARec*
  1339. AspectRgInInfo: FMind;
  1340.   ,      tc - 
  1341. IARRp*not ValOnlDoProrue );
  1342.  
  1343. MindI
  1344.   ,         - ,RARec*
  1345. = PRGBArraDoProrue );
  1346.  ft + 1 to Val := maot xcept := ( ft + 1 to e;
  1347.  ;elbrot
  1348.             be AMandelSet.FVersion =d;
  1349.         end
  1350.   Filu     elserst time
  1351.   );
  1352.     exit;
  1353.     en   DoProgreor T         exit;
  1354.          exit;
  1355.  
  1356.   ,ree;
  1357.                   eFile:='sume'            N>= :='
  1358.  nd000'                  tc:='-0.75'                    :='0'            
  1359.        :='0.4'            := paFIt'     s'            Vers:='100'            Offlser='0'            ValOnr='550'            RGBArrr='530'            AspectR:='1'            Priority:='HBAr'             end;:=e;
  1360.  ;el          gin //=''            map: TB:='128'                mi, r='0'            Realnv,Dr='0'            eighyC:='Pot   ial'            d;
  1361.    :='Z<-Z^2+C(N;
  1362.  l)'             omm   //='Sp*te   Rf ar.al'            n
  1363.  :=D( Bn
  1364.  ToStr(N;w)             ronor='0:00:00:000'              serve     ''    tn
  1365.  usatr T        FSp*t     mssume;
  1366.         
  1367.               FW AMandelSet.FVersion = 'draw
  1368.     exit;
  1369.  Do      (        tbegin // too small
  1370.     CutBorders( ogrOnrminated       ion.TerTrmina
  1371.    t    finally
  1372.    Onrminatedab4.Velbrot.Fi// too small
  1373.     CutBorders( ogrBound       ion.TerCardResu    finally
  1374.    Bounded:
  1375. Velbrot.Fi// too small
  1376.     CutBorders( Terminated arminated   end;
  1377.   = -nd tb2.Tnally
  1378.   Co  inu := Step shr 1;
  1379.     Pas
  1380.   end;
  1381.  
  1382. plose( rect( 0, TMandelbrot.Prepare( Alose( rect( 0 Te
  1383.    ts;
  1384. FHuses   s own criti
  1385.    ser.FHes 0:= Falselose( rect( 0 Synchronize(Alose( rect( 0 Te
  1386.    ts;)elbrot
  1387.  t.Fi/eft 
  1388.   end;
  1389.  
  1390. plOnrminateda TMandelbrot.Prepare( A;
  1391.   rminateda= Fillgin( rminateda= 1illgin( GgrBockC   tb1. begin
  1392.   >  Bounde) 
  1393.  
  1394. function TMandelbrot.ACo  inu  to Val := maot   Onrminated( Self,ACo  inu , rminateda
  1395. ielbrot.Aht, AReCo  inu  
  1396.       if IsOdSysUtils.Abo,Dprodv,Ima begin
  1397.      GgrBockC   t 0, hw - reaom );
  1398.     end;// too snally
  1399. andesHee(:    dResu o 0;el small
  1400.     CutBorders( Te      ( A      erT      Ki
  1401.    Keeprmina: Beters
  1402.   TUpdatingInnally
  1403.   th, ky, kx);
  1404.       Update
  1405.       be in
  1406.        Updateh, vup, vdw, vlf,Avrg   end;
  1407.     fi       if 
  1408.  Trip]; 0, hw x87 n
  1409.  :    dResuhr 1;
  1410.     Pas
  1411. ateBandesHee(      tworks oeger2^n
  1412.  
  1413. ndes ;-)elbrx87 n
  1414.   to VndesHee(hr 1;       tb4.A       end;
  1415.  Keeprmina wr := Rect.Right - r] := 0;
  1416. FH)   ialize;
  1417.     enructor TMandidth;y
  1418.  
  1419. proce      tb1.Re}
  1420.       test AX,DX     frx87 n
  1421.   <>BandesHee(  ] then
  1422.       exit
  1423.    s.re'nda new  tc;
  1424.   bet87 cs>= ng); int = 0 ) a
  1425.       be=in
  1426.       ( ( w.Sc nineDiffy ]a
  1427. ielbrot.Ath:= i   nv* fwe );
  1428.  -  exit;
  1429.  ndidth;x
  1430.  
  1431. proce ht - 1 ); 1;
  1432.     for ky := 0 to my do   Ath:ate( self );( bar, 0 );
  1433.   bar := re     fr       t4.Resumeb
  1434.       if IsOdd        hh := par.tcoc    Colors:FromVersToColor
  1435.   eate( self );
  1436. S   chRB(.tcoc ate( self );
  1437.  0,      tb2.R) then
  1438.               hh := par. fr nv> end
  1439.     els self );(up bar, 0 );
  1440.   b- fwe );
  1441.  ]e( self );
  1442.  ) then
  1443.         x(up bar,;  hh := par. fr nv<e      tb1.Red
  1444.     els self );(dw bar, 0 );
  1445.   b+ fwe );
  1446. ]e( self );
  1447.  ) then
  1448.         x(dw bar,;  hh := par. fr xv> end
  1449.     els self );(lf bar, 0 );
  1450.   b- 1
  1451. ]e( self );
  1452.  ) then
  1453.         x(lf bar,;  hh := par. fr xv<e ht - 1 ); d
  1454.     els self );(rg bar, 0 );
  1455.   b+ 1
  1456. ]e( self );
  1457.  ) then
  1458.         x(rg bar,;  hh := par.tcoc          edVelbrsToCol(        ,eh, vup, vdw, vlf,Avrg ate( self );
  1459.  0,te( self );
  1460.       [r xvr Rec    s;
  1461.   B
  1462. t( 0, 0, hw - 
  1463.  Keeprmina wr := Recttttt.Right - r]  nv/
  1464. = PRGBArra1.Res 
  1465. ielbrot.Areaom );      be par.FHeight - 1 ), f (    edVelbrsToCol(      erT      Ki
  1466.    VtcdaVtcUpdaVtcDowndaVtcht - 1Vtcar.Le   end;
  1467.   )if 
  1468.  Trip]; 0, hnally
  1469.   sat, lh, hu := end;
  1470.     fi  lum: Bytehr 1;
  1471.     Pasxtende     tMaxItr, IkEdg;tb4.FRectest AX,DX    l( barab    Fl  not, 0 ect , 0down t , 0l      , 0
  1472.   bu v/
  1473. ielbrot.Al( barmp.Sl( /0, FalIter 0, hw - l( barrmp.Sl( *Sl( *Sl(t
  1474.  gammat4.30, hw - lur: TR255p.SVal   Al( *S255p
  1475. ielbrot.Art + 1.rgbtBlu  to lurielbrot.Art + 1.rgbtGreen to lurielbrot.Art + 1.rgbtRe     lurielbrot.A       tb3.kBumpertb4.FRectest AX,DX    lh:= i  ot, 0 ec- , 0down ) +not, 0l    - , 0
  1476.   bu v v/
  1477. 2ielbrot.Al( barmp.Sl( /0, FalIter 0, hw - l( barrmp.Sl( *Sl( *Sl(t
  1478.  gammat4.30, hw - lur: TRVal   Al( *S127b+ 128p
  1479. ielbrot.Art + 1.rgbtBlu  to lurielbrot.Art + 1.rgbtGreen to lurielbrot.Art + 1.rgbtRe     lurielbrot.A       tb3.kColorBumpertb4.FRectest AX,DX    sa1 to 1te( self lh:= i  ot, 0 ec- , 0down ) +not, 0l    - , 0
  1480.   bu v v/
  1481. 2ielbrot.Ahu  to    Fl /0, FalIterp
  1482. ielbrot.AHSLto
  1483.  (hu , sat, lh, rt + 1)ielbrot.A       tb3.kRGBArrrb4.FRectest AX,DX    lh:= i, 0down -t, 0 e;0, hw - lur: TRVal   A(Sl( /0, FalItern
  1484. *P127b+ 128p
  1485. ielbrot.Art + 1.rgbtRe     lurielbrot.Alh:= i, 0ar.Left vtcht -;0, hw - lur: TRVal   A(Sl( /0, FalItern
  1486. *P127b+ 128p
  1487. ielbrot.Art + 1.rgbtGreen to lurielbrot.Alur: TRVal   A(S Fl /0, FalIterp
  1488.  *S255p
  1489. ielbrot.Art + 1.rgbtBlu  to lurielbrot.A       tb3.kUnsharpMasktb4.FRectest AX,DX    lh:= i  VtcDownb+ VtcUpb+ VtcrocedureVtcht -u v/
  1490. 4ielbrot.Alh:= i    +i  Vtcp.Sl( 
  1491. ielbrot.Aht,l  <t; d
  1492.     els sell( barmelbrot.A eft 
  1493.  l( >0, FalIterpd
  1494.     els sell( bar, FalIter 0, hw - rt + 1 to Colors:FromVersToColor
  1495.  l( 
  1496. ielbrot.A       tb3.kAverag;tb4.FRectest AX,DX    l( bar  VtcDownb+ VtcUpb+ VtcrocedureVtcht -u v/
  1497. 4ielbrot.Alh:= i(i    +ilvv v/
  1498. 2ielbrot.Aht,l  <t; d
  1499.     els sell( barmelbrot.A eft 
  1500.  l( >0, FalIterpd
  1501.     els sell( bar, FalIter 0, hw - rt + 1 to Colors:FromVersToColor
  1502.  l( 
  1503. ielbrot.A       tb3.kNois;tb4.FRectest AX,DX    rt + 1 to Colors:FromVersToColor
  1504.   Fl 
  1505. ielbrot.Aht,Rt -om w2ea = end
  1506.     els sel       hh := pa
  1507.  toHSL( rt + 1, hu , sat, lh ate( self );l( barf ar(l b+ Rt -om   0.5n- 0.25ate( self );HSLto
  1508.  (hu , sat, lh, rt + 1)ielbrot.A2.Resume;
  1509.           tb3.k    s:FWidth;
  1510. TMandelbrot.A;
  1511.       <>BVtcUpbllgin(    <>BVtcDown ) gin(     <>BVtcht -u vgin(     <>BVtcR
  1512.   bu vd
  1513.     els selRt + 1 to Colors:FromVersToColor
  1514.   Fl 
  1515. elbrot.A eft    els sel       hh := pa
  1516. t + 1.rgbtBlu  to 0;  hh := pa
  1517. t + 1.rgbtGreen to 0;  hh := pa
  1518. t + 1.rgbtRe     0ielbrot.A2.Resume;
  1519.           tb3.kCristals:FWidth;
  1520. TMand  FWidth;
  1521. ;
  1522.       <>BVtcUpbllded;
  1523.     <>BVtcDown ) ded;
  1524.     <>BVtcht -u vded;
  1525.     <>BVtcR
  1526.   bu vd
  1527.     els selRt + 1 to Colors:FromVersToColor
  1528.   Fl 
  1529. elbrot.A eft    els sel       hh := pa
  1530. t + 1.rgbtBlu  to 0;  hh := pa
  1531. t + 1.rgbtGreen to 0;  hh := pa
  1532. t + 1.rgbtRe     0ielbrot.A2.Resume;
  1533.           tb3.kEq gin //FWidth;
  1534. TMand  FWidth;
  1535. ;
  1536. and .Fbaxr=
  1537. and .FMnd d
  1538.     els sell( barvalelbrot.A eft   els sell( bar(i  Vtcp.Sand .Fbinv v/
  1539. (
  1540. and .Fbaxr-
  1541. and .FMnd 
  1542.     , Fali   gInInfo: elRt + 1 to Colors:FromVersToColor
  1543.  l( 
  1544. ielbrot.A       tb3       tS   chRB(.Rt + 1 )om );      be par.FHeight - 1 ), fGetPercentDrawn   end;
  1545.     finally
  1546.   h, vbax);
  1547.       Updated, nd);
  1548.       Update
  1549.     exit;
  1550.     enF not or TMandelbrot.Creavbax bar, Falht - 1*
  1551. = PreadBounded.Create( selN:= iep;
  1552.         0ielbrotn     0ielbrot,st(4)  <tvbax }
  1553.       test AX,DX     fr, 0 );
  1554. vvr = end
  1555.     els selo   Atd 
  1556. elbrot.A eft    els selo   Ad 
  1557. ielbrot.Ah   Av,ant       tget umebpo
  1558.   everyant elbrot.A       tb3       trt + 1 to dv/
  1559. (
  1560. td +Ad 
  1561. ielbr frrt + 1 >=t; d
  1562.     elsrt + 1 to 0.9999999999ot.Fi// too small
  1563.     CutBorders( nated and tb1.Tnally
  1564.   h, vbax);
  1565.       Updatep: ^  begin
  1566.     est AX,DX  setand tb1.T   enF not or TMandelbrot.Creavbax bar, Falht - 1*
  1567. PreadBounded.Cr Updatep bar@, 0 );
  1568. 0bar := reidthv
  1569.  
  1570. procevbax }
  1571.       test AX,DX     frp^ =0, FalIterpd
  1572.     els selI   F nsideC   t
  1573. ielbrot.Aht,( 
  1574. Min = -nd vgin( p^ < Fbinv vd
  1575.     els selFbinvto p^ielbrot.Aht,((
  1576.  
  1577.  x = -nd vgin( p^ > Fbaxr) vded;
  1578. p^ < , FalIterp
  1579.  d
  1580.     els selFbax barp^ielbrot.Ah   Ap 
  1581. ielbrot.A       tb3       t// too small
  1582.     CutBorders(   setand tb1.T exit;
  1583.     enF not or TMandelbrot.CreaF nsideC   t    0ielbrot
  1584. Min := -nielbrot
  1585. Max bar-nielbrot       tFMndc   t    0ielbr// too small
  1586.     CutBorders( otore       end;nally
  1587.      ev      tb4.F       end;// too small
  1588.     CutBorders(   store       end;nally
  1589.   FHe)fors.re wanda R)    treaighy        fr   ev      t<>BResumeb
  1590.       if Do      (    ev      tbegin // too small
  1591.     CutBorders( ogrose( rect( 0(Aect( 0: Tect( 0polate(    finally
  1592.     se( rect( 0, 0,Aect( 0egin // too s// 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/ 4/