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 Imal x, tp ImagT1}
  934.  mnmeRprw    mD   R1}
  935.       test AXstp magl x, tp ImagT1}
  936.             {CR                           R6}
  937.         fld CI               {t, st(6)       {temp:   {R3}
  938.       fstp DProdv    t           {temp:=temp*temp         end;
  939.     }
  940.  
  941.     ffEight:t         {PZ:=ZR                       R4}
  942.         fld P}
  943.       fstp DProdv =ZqI  ZqI:=ZqR          0tem2              R0}1)           {ZqR:=ZqI  ZqI:=ZqR          2                  R0            R0}
  944.       fadd st  {Phs     fstp DProdv        -   R1}
  945.         fadd s=ZqI  ZqI:=ZqR          2                  R0   R
  946.         fadd s=ZqI  ZqI:=ZqRPZ:=PZ*tem3                  R0}R
  947.         fadd s=ZqI  ZqI:=ZqR          6tem2              R0}
  948.         fadd st,s            {temp:=ZZqI            R      R0}
  949.         fmul st(4),st        {
  950.       fstp Imagqv        R6}
  951.       fld CI               {CZqR          0tem2              R0}1)           {ZqR:=ZqI  ZqI:=ZqR          2                  R0   R
  952.         fadd s=ZqI  ZqI:=ZqRtem2:=PZ  2                  R0-           R0}
  953.       fadd st  {t, st          {temp:=temp*temp              R0}
  954.       fstp   {tem2:=tem2+tem2              R0}
  955.         fld st(0)            {test          {tempp:=temp*temp              R0}
  956.       fst s  {temp:=temp*temp             {ZqR             R0}
  957.       fst s  {temp:=Z                I     R0}
  958.         fmul st(4),st        {
  959.     6)       {temp:=temp+CR                R0}
  960.       fxch   {temp:=temp*temp             R*CR                R0)            {test  2 R1}
  961.       test AXR:=temp            R0}
  962.       fmul   {temp:=temp+CR                R1}
  963.         fst st(3)0           {PZ:=temp     {temp:=temp+CI                R0}
  964.       fst  stst(4)           {ZI:=temp                     R0}
  965.       fmul stst, st          {temp:=temp*temp              R0}
  966.       f {temp:={temp:=temp*temp              R1}
  967.         fxch st(1)           {emp*temp      R1}t   R1}t         R1}
  968.  {      fadd st,           {emp*t     fxch st(1)  :         R1}
  969.      R1}t   R)          {emp*temp stp Imagqv      {eZ  tb4.FRectest AX,DX    Info.Xbegin;X,DX    Info.Ybegin        R2Vers := Pep;
  970.     is fkN:= ep;
  971.     ir      = Pep;
  972.     ii      = ep;
  973.     idating = ep;
  974.     i,st(4) ors    v kx, ky, ended;
  975. s fkN:<tp I)hr 1;
  976.     for ky := 0 to my do       v        tb2.Info = PZPoweDifInfo;Info         tb2.Info.0;
  977.  Info.0ro       R2}2.Info.y;
  978.  Info.yb st,st(2)   ii      =  Info.y*Info.yt,st(2)   ir      = PInfo.0*Info.    maxv := s fkN:= ii      +ir            tb2.Resume;
  979.                {eing[16];tb4.FRectest AX,DX    Info.Xbegin;X,DX    Info.Ybegin        R2c.Xbegio       R2}c.YbegiC        R2Vers := Pep;
  980.     is fkN:= 1p;
  981.     ir      = Pep;
  982.     ii      = ep;
  983.     idating = ep;
  984.     i,st(4) ors    v kx, ky, ended;
  985. s fkN:<tp I)hr 1;
  986.     for ky := 0 to my do       v        tb2.Info = PZA
  987.   wZSqDifInfoesumInfo;
  988. al;
  989.         z      =  Info.y*Info.yt,st(2)   ir      = PInfo.0*Info.    maxv := s fkN:= ii      +ir            tb2.Resume;
  990.                {eFAspectb4.FRectest AX,DX    Info.Xbegi0.5+n;X,DX    Info.Ybegi0+n        R2c.Xbegio       R2}c.YbegiC        R2Vers := Pep;
  991.     is fkN:= ep;
  992.     ir      = Pep;
  993.     ii      = ep;
  994.     i,st(4) ors    v kx, ky, ended;
  995. s fkN:<tp I)hr 1;
  996.     for ky := 0 to my do       v        tb2.Info = PZMul(PZMul(cumInfosumZSub();
  997. ZSqDifInfoesogress;
  998.       z      =  Info.y*Info.yt,st(2)   ir      = PInfo.0*Info.    maxv := s fkN:= ii      +ir            tb2.Resume;
  999.                {eJulia    : botb4.FRectest AX,DX    Info.Xbegin;X,DX    Info.Ybegin        R2c.Xbegio       R2}c.YbegiC        R2t1 = PZPoweDicum0.15     0.15conda R) e 1;lia     t bo      R2Vers := Pep;
  1000.     is fkN:= ep;
  1001.     ir      = Pep;
  1002.     ii      = ep;
  1003.     i,st(4) ors    v kx, ky, ended;
  1004. s fkN:<tp I)hr 1;
  1005.     for ky := 0 to my do       v        tb2.Info = PZA
  1006.   wZMul(PZSqDiInfosumtResum
  1007. al;
  1008.         z      =  Info.y*Info.yt,st(2)   ir      = PInfo.0*Info.    maxv := s fkN:= ii      +ir            tb2.Resume;
  1009.                {e strtb4.FRectest AX,DX    Info.Xbegin;X,DX    Info.Ybegin        R2c.Xbegio       R2}c.YbegiC        R2Vers := Pep;
  1010.     is fkN:= ep;
  1011.     ir      = Pep;
  1012.     ii      = ep;
  1013.     i,st(4) ors    v kx, ky, ended;
  1014. s fkN:<tp I)hr 1;
  1015.     for ky := 0 to my do       v        tb2.Info = PZPoweDicumInfos;
  1016.         z      =  Info.y*Info.yt,st(2)   ir      = PInfo.0*Info.    maxv := s fkN:= ii      +ir            tb2.Resume;
  1017.                {eSter := rounest AX,DX    Info.XbegiCR+n;X,DX    Info.YbegiCI+n        R2c.Xbegio       R2}c.YbegiC        R2Vers := Pep;
  1018.     is fkN:= ep;
  1019.     ir      = Pep;
  1020.     ii      = ep;
  1021.     i,st(4) ors    v kx, ky, ended;
  1022. s fkN:<tp I)hr 1;
  1023.     for ky := 0 to my do       v        tb2.Info = PZMul(PZSteiInfosumcs;
  1024.         z      =  Info.y*Info.yt,st(2)   ir      = PInfo.0*Info.    maxv := s fkN:= ii      +ir            tb2.Resume;
  1025.                {eSteTaer := rounest AX,DX    Info.XbegiCR+n;X,DX    Info.YbegiCI+n        R2c.Xbegio       R2}c.YbegiC        R2Vers := Pep;
  1026.     is fkN:= ep;
  1027.     ir      = Pep;
  1028.     ii      = ep;
  1029.     i,st(4) ors    v kx, ky, ended;
  1030. s fkN:<tp I)hr 1;
  1031.     for ky := 0:= False  Z<-C*(steiZ+taeiZ))) 0 to my do       v        tb2.Info = PZMul(PC,PZSteiPZA
  1032.   wZnfo;ZTae wZnfoesogreal;
  1033.         z      =  Info.y*Info.yt,st(2)   ir      = PInfo.0*Info.    maxv := s fkN:= ii      +ir            tb2.Resume;
  1034.                {eSpidertb4.FRectest AX,DX    Info.Xbegin;X,DX    Info.Ybegin        R2c.Xbegio       R2}c.YbegiC        R2Vers := Pep;
  1035.     iz      =  ep;
  1036.     ir      = Pep;
  1037.     is fkN:= iep;
  1038.     i,st(4) ors    v kx, ky, ended;
  1039. s fkN:<tp I)hr 1;
  1040.     for ky := 0 to my do       v        tb2.Info = PZA
  1041.   wc
  1042. ZSqDifInfoesog       tb2.c = PZA
  1043.   Info;ZDiv wc
  1044. 2 )l;
  1045.         z      =  Info.y*Info.yt,st(2)   ir      = PInfo.0*Info.    maxv := s fkN:= ii      +ir            tb2.Resume;
  1046.                {e
  1047.    etismtb4.FRectest AX,DX    Info.Xbegin;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.t1 = PZSqDifZA
  1054.   wZA
  1055.   wc
  1056. ZSqDifInfoesog, -1sog       tb2.t2 = PZSqDifZA
  1057.   wZA
  1058.   wc
  1059. Info;Info  , -2)         tb2.Info = PZDiv w    enal;
  1060.         z      =  Info.y*Info.yt,st(2)   ir      = PInfo.0*Info.    maxv := s fkN:= ii      +ir            tb2.Resume;
  1061.                  {xten        s fkN:= ir      +ii             if U:= ir      -ii      +io       ifo th:= idating +iC    d := nil;
  1062. i   v kx, ky, 
  1063.  
  1064. function TMandelbrot.A extendeeighyCar.FWidth;  R2Vers:FWidth;  R2         hh := par.FHft + 1 to     v.FRect := rect( 0, 0, hw - 1, hVepstas:FWidth;  R2         hh := par.FHft + 1 to i   v +not ExtraParmp.SLe wLe ws fkN:    0.5n
  1065.      ExtraPar2itmap ExtraParmpto Le wLe wagqv, for kx 
  1066.       ExtraPar2 dth + Le w2eate( self );
  1067. t( 0, 0, hw - 1, hSum:  FWidth;  R2         hh := par.FHft + 1to sqrt ws fkN:     ExtraParm;magqExtraParm ProdVer + bfor kx}e( self );
  1068. t( 0, 0, hw - 1, h    :FWidth;  R2         hh := par.FHft + 1= ii         ExtraParm;mgqExtraParm ProdVer + bfor kx ^ 2}e( self );
  1069. t( 0, 0, hw - 1, h  if: FWidth;  R2         hh := par.FHft + 1to r         ExtraParm;magqExtraParm ProdVer + bfor kx ^ 2}e( self );
  1070. t( 0, 0, hw - 1, h    : FWidth;  R2         hh := par.FHft + 1to sqrt ws fkN:     ExtraParm       v.r.FHgqExtraParm P1 + bfor kx}e( self );
  1071. t( 0, 0, hw - 1, hSumI: FWidth;  R2         hh := par.FHft + 1to    v  notsqrt ws fkN:     ExtraParm );.FHgqExtraParm P1 + bfor kx}e( self );
  1072. t( 0, 0, hw - 1, hBioM:FWidth;  R2         hh := par.FH;
  1073.  r      <tp )begin(i      <tp )b
  1074.       if IsOdd and ft + 1 to     ve( self );
  1075. t( ) then
  1076.         x :ft + 1 to 1te( self );
  1077. t( 0, 0, hw - 1, hRadiant:FWidth;  R2         hh := par.FHft + 1 to (   nv := 0ifo th, r   Real ap ExtraParmp +n0.5n
  1078. *ProdVerstmap ExtraParmp= pi
  1079. *P2e( self );
  1080. t( 0, 0, hw - 1, h    Rad:FWidth;  R2         hh := par.FHft + 1 to     v +not  nv := 0ifo th, r   Real ap ExtraParmp +n0.5n
  1081. stmap ExtraParmp= pi
  1082. *P2hh := par.FHe( self );
  1083. t( 0,      tb2.R) then
  1084.        ft + 1 to rodVers;
  1085.   B
  1086. t( 0, 0, hw - rea := ( Left = 0 ) aTMandelbrot.A extendeeighyCar.FWidth;  R2VntMod:FWidth;  R2         hh := par.FHrt + 1 to sqrt ws fkN:     ExtraParm;mgqExtraParm ProdVer + bfor kx}e( self );
  1087. t( 0, 0, hw - 1, h ntRadiant:FWidth;  R2         hh := par.FHft + 1 to (   nv := 0ifo th, r   Real ap ExtraParmp +n0.5n
  1088. *ProdVerstmap ExtraParmp= pi
  1089. *P2e( self );
  1090. t( 0,      tb2.R) then
  1091.        ft + 1 to rodVers;
  1092.   B
  1093. t( 0, 0, hw - reaom );
  1094.     end;
  1095.  ft + 1 <  end
  1096.     elsft + 1 to 1e-1ep;
  1097.    ;
  1098.  magqv    R)    TRectemlors.re some errdelSin rothqv            
  1099.  
  1100.     r1  par.FHeight - 1 ), f2 ) then
  1101. kip the first time
  1102.   ):= Step shr 1;
  1103.     Pass( tru     else 1;
  1104.     nterpEvenagqv,      tc    enrToFloa    (
  1105.       tcdatingInfo: agqv,            enrToFloa    (
  1106.         datingInfo: agqv,
  1107.            enrToFloa d  (
  1108.  
  1109.        ,and tb2.Teragqv,R   tb4.enrToFloa    (
  1110. R   ,antingInfo: agqv,t do
  1111.    enrTo nt   (
  1112. t dodatingInfo: 
  1113.  agqv,t do
  1114. <in
  1115.  
  1116.       if Isagqv,t do
  1117.    32gInfo: agqv, );
  1118.     ienrTo nt   (
  1119.  );
  1120.  datingInfo: 
  1121.  agqv, );
  1122.   <in
  1123.  
  1124.       if Isagqv, );
  1125.     i32gInfo: agqv,AspectRtb4.enrToFloa    (
  1126. AspectR,and tb2.Teragqv, end;ABit end;tb2.Teragqv, for kx   ienrTo nt   (
  1127.  for kx, 4d tb2.Teragqv,    mi, tb4.enrToFloa    (
  1128.     mi, datingInfo: agqv,Realnv,Dtb4.enrToFloa    (
  1129. Realnv,DdatingInInfo: 
  1130.  Fa= pa= 'gin
  1131.     Co256' 
  1132.  
  1133. function TMandelbrot.Aidth := paFIter   Bmp.He 0, hw - rea := ( Left 
  1134.  Fa= pa= 'gin
  1135.     Co8' 
  1136.  
  1137. function TMandelbrot.Aidth := paFIter   Bmp8 0, hw - rea := ( Left 
  1138.  Fa= pa= 'gin
  1139.     Co2' 
  1140.  
  1141. function TMandelbrot.Aidth := paFIter   Bmp
  1142.     0, hw - rea := ( Left 
  1143.  Fa= pa= 'axIte' 
  1144.  
  1145. function TMandelbrot.Aidth := paFIteraxIte 0, hw - rea := ( Left 
  1146.  Fa= pa= '    Re' 
  1147.  
  1148. function TMandelbrot.Aidth := paFIter    Re 0, hw - rea := ( Left 
  1149.  Fa= pa= 'erp25' 
  1150.  
  1151. function TMandelbrot.Aidth := paFItererp25 0, hw - rea := ( Left 
  1152.  Fa= pa= '     sMP' 
  1153.  
  1154. function TMandelbrot.Aidth := paFIterpolate( 2 0, hw - rea := ( Left FHei  endunction TMandelbrot.Aidth := paFIterpolate(ume;
  1155.                  
  1156.  FeighyC='R.^2+I.^2 (mod)'
  1157.  
  1158.       if Isagqv,eighyCab4.eum := ( Left 
  1159.  FeighyC='Pot   ial'
  1160.  
  1161.       if Isagqv,eighyCab4.Vepstas := ( Left 
  1162.  FeighyC='R   ar.FHes*mod'  end;
  1163.  endlegacy   if Isagqv,eighyCab4.     := ( Left 
  1164.  FeighyC='R   a.FHes*mod'  end   if Isagqv,eighyCab4.     := ( Left 
  1165.  FeighyC='R   ar.FHes+mod'  end;
  1166.  endlegacy   if Isagqv,eighyCab4.SumI := ( Left 
  1167.  FeighyC='R   a.FHes+mod'  end   if Isagqv,eighyCab4.SumI := ( Left 
  1168.  FeighyC='    ^2'  end   if Isagqv,eighyCab4.     := ( Left 
  1169.  FeighyC='Realinary^2'  end   if Isagqv,eighyCab4.Real := ( Left 
  1170.  FeighyC='R  Bmntc mod'  end   if Isagqv,eighyCab4.VntMod := ( Left 
  1171.  FeighyC='R  Bmntc radiant'  end   if Isagqv,eighyCab4.VntRadiant := ( Left 
  1172.  FeighyC='Biomorph'  end   if Isagqv,eighyCab4.BioM := ( Left 
  1173.  FeighyC=' adiant'  end   if Isagqv,eighyCab4.Radiant := ( Left 
  1174.  FeighyC='Radiant+R   '  end   if Isagqv,eighyCab4.V   Rad := ( Left = 0 ) aagqv,eighyCab4.V   gInInfo: 
  1175.  Fd;
  1176.    ='Z<-Z^4+C' 
  1177.  
  1178. function TMandelbrot.Aidth = ABi:=e;
  1179.  ;elbrot.Aidth d;
  1180.    :=e    R0 0, hw - rea := ( Left 
  1181.  Fd;
  1182.    ='Z<-Z^3+C' 
  1183.  
  1184. function TMandelbrot.Aidth = ABi:=e;
  1185.  ;elbrot.Aidth d;
  1186.    :=e mp*t 0, hw - rea := ( Left 
  1187.  Fd;
  1188.    ='Z<-Z^2+C^2' 
  1189.  
  1190. function TMandelbrot.Aidth = ABi:=Val := maot.Aidth d;
  1191.    :=e  ABi 0, hw - rea := ( Left 
  1192.  Fd;
  1193.    ='Z<-Z^3+C^2' 
  1194.  
  1195. function TMandelbrot.Aidth = ABi:=Val := maot.Aidth d;
  1196.    :=e mp*t 0, hw - rea := ( Left 
  1197.  Fd;
  1198.    ='Z<-Z^8+C' 
  1199.  
  1200. function TMandelbrot.Aidth = ABi:=e;
  1201.  ;elbrot.Aidth d;
  1202.    :=e E );
  1203.     de- rea := ( Left 
  1204.  Fd;
  1205.    ='Z<-Z^Z+C' 
  1206.  
  1207. function TMandelbrot.Aidth = ABi:=e;
  1208.  ;elbrot.Aidth d;
  1209.    :=e Zei 0, hw - rea := ( Left 
  1210.  Fd;
  1211.    ='Z<-Z^2+Z+C' 
  1212.  
  1213. function TMandelbrot.Aidth = ABi:=e;
  1214.  ;elbrot.Aidth d;
  1215.    :=e ing[16]; 0, hw - rea := ( Left 
  1216.  Fd;
  1217.    ='Z<-Z^C' 
  1218.  
  1219. function TMandelbrot.Aidth = ABi:=e;
  1220.  ;elbrot.Aidth d;
  1221.    :=e ZeiC 0, hw - rea := ( Left 
  1222.  Fd;
  1223.    ='Z<-Z*C*(1-Z)' 
  1224.  
  1225. function TMandelbrot.Aidth = ABi:=e;
  1226.  ;elbrot.Aidth d;
  1227.    :=e FAspec 0, hw - rea := ( Left 
  1228.  Fd;
  1229.    ='Z<-steiZ)+C' 
  1230.  
  1231. function TMandelbrot.Aidth = ABi:=e;
  1232.  ;elbrot.Aidth d;
  1233.    :=e ite 0, hw - rea := ( Left 
  1234.  Fd;
  1235.    ='Z<-C*(siZ+tiZ)))'  end;
  1236. Z<-C*(steiZ+taeiZ))) 0 to myTMandelbrot.Aidth = ABi:=e;
  1237.  ;elbrot.Aidth d;
  1238.    :=e iteTae 0, hw - rea := ( Left 
  1239.  Fd;
  1240.    ='Spider' 
  1241.  
  1242. function TMandelbrot.Aidth = ABi:=e;
  1243.  ;elbrot.Aidth d;
  1244.    :=e ipider 0, hw - rea := ( Left 
  1245.  Fd;
  1246.    ='
  1247.    etism' 
  1248.  
  1249. function TMandelbrot.Aidth = ABi:=e;
  1250.  ;elbrot.Aidth d;
  1251.    :=e 
  1252.    etism 0, hw - rea := ( Left 
  1253.  Fd;
  1254.    ='Julia    : bo' 
  1255.  
  1256. function TMandelbrot.Aidth = ABi:=e;
  1257.  ;elbrot.Aidth d;
  1258.    :=e Julia    : bo 0, hw - rea := ( Left = 0 ) aTMandelbrot.Aidth d;
  1259.    :=e  ABi 0, hw - idth = ABi:=e;
  1260.  ;elbrot.Areaom );
  1261.   DoProgreb2.F time
  1262.       elsft + 1 to  ( wr >= 32 )om );
  1263.  xcept := ( 2 ) then
  1264.       else  //  mlsft + 1 to e;
  1265.  ;elbrot
  1266.             be par.FHeight - 1 ), f ( wr >= 32 ):= Step shr 1;
  1267.     Pass( trpuctor TMandnterpEv    xtendeeighyCar.FWidthSum: = 0 ) aTMandelbrot.A ExtraParmpto ,R   t/itmap: TBielbrot.Areaom );
  1268. Vepstas:FWidth;TMandelbrot.A ExtraParmpto Le wLe w, for kx 
  1269.  ;elbrot.A ExtraPar2 = Ph + Le w2eate( self  );
  1270.   FTim   :  FWidth;TMandelbrot.A ExtraParmpto 1t/itmap: TBielbrot.Areaom );
  1271. SumI:FWidth;TMandelbrot.A ExtraParmpto 1t/itmap: TBielbrot.Areaom );
  1272.   if: = 0 ) aTMandelbrot.A ExtraParmpto ,R   t/i w, for kx *w, for kx ielbrot.Areaom );
  1273.     :FWidth;TMandelbrot.A ExtraParmpto ,R   t/i w, for kx *w, for kx ielbrot.Areaom );
  1274.  ntMod:FWidth;TMandelbrot.A ExtraParmpto ,R   t/itmap: TBielbrot.Areaom );
  1275.  ntRadiant:FWidth;TMandelbrot.A ExtraParmpto pi
  1276. *P2ielbrot.Areaom );
  1277. BioM:FWidth;TMandelbrot.A ExtraParmpto ,R   t/itmap: TBielbrot.Areaom );
  1278. Radiant:FWidth;TMandelbrot.A ExtraParmpto pi
  1279. *P2ielbrot.Areaom );
  1280.     Rad:  FWidth;TMandelbrot.A ExtraParmpto pi
  1281. *P2ielbrot.Areaom );
  1282. Left = 0 ) a ExtraParmpto 0;elbrot
  1283.     FWidth;FHe)    c rect( Bdrpuc>= 32 ) and 
  1284.  
  1285.  ColorVal    to ,R       tbaxree;
  1286. . Ususume eect.  be,R   tbkx    c nTM diffee( rSin some f;
  1287.    ) and 
  1288. IARecto 1t/i(
  1289.  
  1290.         *w, r2, true );
  1291.  
  1292. IARRpto ,RARec*
  1293. AspectRgInInfo: FMind;
  1294.   ,      tc - 
  1295. IARRp*not ValOnlDoProrue );
  1296.  
  1297. MindI
  1298.   ,         - ,RARec*= PRGBArraDoProrue );
  1299.  ft + 1 to Val := maot xcept := ( ft + 1 to e;
  1300.  ;elbrot
  1301.             be AMandelSet.FVersion =d;
  1302.         end
  1303.   Filu     elserst time
  1304.   );
  1305.     exit;
  1306.     en   DoProgreor T         exit;         exit;
  1307.  
  1308.   ,ree;
  1309.                   eFile:='sume'            N>= :='
  1310.  nd000'                  tc:='-0.75'                    :='0'            
  1311.        :='0.4'            := paFIt'     s'            Vers:='100'            Offlser='0'            ValOnr='550'            RGBArrr='530'            AspectR:='1'            Priority:='HBAr'             end;:=e;
  1312.  ;el          gin //=''            map: TB:='128'                mi, r='0'            Realnv,Dr='0'            eighyC:='Pot   ial'            d;
  1313.    :='Z<-Z^2+C(N;
  1314.  l)'             omm   //='Sp*te   Rf ar.al'            n
  1315.  :=D( Bn
  1316.  ToStr(N;w)             ronor='0:00:00:000'              serve     ''    tn
  1317.  usatr T        FSp*t     mssume;
  1318.         
  1319.               FW AMandelSet.FVersion = 'draw
  1320.     exit;
  1321.  Do      (        tbegin // too small
  1322.     CutBorders( ogrOnrminated       ion.TerTrmina
  1323.    t    finally
  1324.    Onrminatedab4.Velbrot.Fi// too small
  1325.     CutBorders( ogrBound       ion.TerCardResu    finally
  1326.    Bounded:Velbrot.Fi// too small
  1327.     CutBorders( Terminated arminated   end;
  1328.   = -nd tb2.Tnally
  1329.   Co  inu := Step shr 1;
  1330.     Pas
  1331.   end;
  1332.  
  1333. plose( rect( 0, TMandelbrot.Prepare( Alose( rect( 0 Te
  1334.    ts;FHuses   s own criti
  1335.    ser.FHes 0:= Falselose( rect( 0 Synchronize(Alose( rect( 0 Te
  1336.    ts;)elbrot
  1337.  t.Fi/eft 
  1338.   end;
  1339.  
  1340. plOnrminateda TMandelbrot.Prepare( A;
  1341.   rminateda= Fillgin( rminateda= 1illgin( GgrBockC   tb1. begin
  1342.   >  Bounde) 
  1343.  
  1344. function TMandelbrot.ACo  inu  to Val := maot   Onrminated( Self,ACo  inu , rminatedaielbrot.Aht, AReCo  inu  
  1345.       if IsOdSysUtils.Abo,Dprodv,Ima begin
  1346.      GgrBockC   t 0, hw - reaom );
  1347.     end;// too snally
  1348. andesHee(:    dResu o 0;el small
  1349.     CutBorders( Te      ( A      erT      Ki
  1350.    Keeprmina: Beters
  1351.   TUpdatingInnally
  1352.   th, ky, kx);
  1353.       Update
  1354.       be in
  1355.        Updateh, vup, vdw, vlf,Avrg   end;
  1356.     fi       if 
  1357.  Trip]; 0, hw x87 n
  1358.  :    dResuhr 1;
  1359.     PasateBandesHee(      tworks oeger2^n
  1360.  
  1361. ndes ;-)elbrx87 n
  1362.   to VndesHee(hr 1;       tb4.A       end;
  1363.  Keeprmina wr := Rect.Right - r] := 0;FH)   ialize;
  1364.     enructor TMandidth;y
  1365.  
  1366. proce      tb1.Re}
  1367.       test AX,DX     frx87 n
  1368.   <>BandesHee(  ] then
  1369.       exit
  1370.    s.re'nda new  tc;
  1371.   bet87 cs>= ng); int = 0 ) a
  1372.       be=in
  1373.       ( ( w.Sc nineDiffy ]aielbrot.Ath:= i   nv* fwe );
  1374.  -  exit;
  1375.  ndidth;x
  1376.  
  1377. proce ht - 1 ); 1;
  1378.     for ky := 0 to my do   Ath:ate( self );( bar, 0 );
  1379.   bar := re     fr       t4.Resumeb
  1380.       if IsOdd        hh := par.tcoc    Colors:FromVersToColor
  1381.   eate( self );
  1382. S   chRB(.tcoc ate( self );
  1383.  0,      tb2.R) then
  1384.               hh := par. fr nv> end
  1385.     els self );(up bar, 0 );
  1386.   b- fwe ); ]e( self );
  1387.  ) then
  1388.         x(up bar,;  hh := par. fr nv<e      tb1.Red
  1389.     els self );(dw bar, 0 );
  1390.   b+ fwe );]e( self );
  1391.  ) then
  1392.         x(dw bar,;  hh := par. fr xv> end
  1393.     els self );(lf bar, 0 );
  1394.   b- 1]e( self );
  1395.  ) then
  1396.         x(lf bar,;  hh := par. fr xv<e ht - 1 ); d
  1397.     els self );(rg bar, 0 );
  1398.   b+ 1]e( self );
  1399.  ) then
  1400.         x(rg bar,;  hh := par.tcoc          edVelbrsToCol(        ,eh, vup, vdw, vlf,Avrg ate( self );
  1401.  0,te( self );
  1402.       [r xvr Rec    s;
  1403.   B
  1404. t( 0, 0, hw - 
  1405.  Keeprmina wr := Recttttt.Right - r]  nv/= PRGBArra1.Res ielbrot.Areaom );      be par.FHeight - 1 ), f (    edVelbrsToCol(      erT      Ki
  1406.    VtcdaVtcUpdaVtcDowndaVtcht - 1Vtcar.Le   end;
  1407.   )if 
  1408.  Trip]; 0, hnally
  1409.   sat, lh, hu := end;
  1410.     fi  lum: Bytehr 1;
  1411.     Pasxtende     tMaxItr, IkEdg;tb4.FRectest AX,DX    l( barab    Fl  not, 0 ect , 0down t , 0l      , 0
  1412.   bu v/4 ielbrot.Al( barmp.Sl( /0, FalIter 0, hw - l( barrmp.Sl( *Sl( *Sl(t
  1413.  gammat4.30, hw - lur: TR255p.SVal   Al( *S255pielbrot.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
  1414.   bu v v/2ielbrot.Al( barmp.Sl( /0, FalIter 0, hw - l( barrmp.Sl( *Sl( *Sl(t
  1415.  gammat4.30, hw - lur: TRVal   Al( *S127b+ 128pielbrot.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
  1416.   bu v v/2ielbrot.Ahu  to    Fl /0, FalIterpielbrot.AHSLto
  1417.  (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
  1418. *P127b+ 128pielbrot.Art + 1.rgbtRe     lurielbrot.Alh:= i, 0ar.Left vtcht -;0, hw - lur: TRVal   A(Sl( /0, FalItern
  1419. *P127b+ 128pielbrot.Art + 1.rgbtGreen to lurielbrot.Alur: TRVal   A(S Fl /0, FalIterp *S255pielbrot.Art + 1.rgbtBlu  to lurielbrot.A       tb3.kUnsharpMasktb4.FRectest AX,DX    lh:= i  VtcDownb+ VtcUpb+ VtcrocedureVtcht -u v/4ielbrot.Alh:= i    +i  Vtcp.Sl( ielbrot.Aht,l  <t; d
  1420.     els sell( barmelbrot.A eft 
  1421.  l( >0, FalIterpd
  1422.     els sell( bar, FalIter 0, hw - rt + 1 to Colors:FromVersToColor
  1423.  l( ielbrot.A       tb3.kAverag;tb4.FRectest AX,DX    l( bar  VtcDownb+ VtcUpb+ VtcrocedureVtcht -u v/4ielbrot.Alh:= i(i    +ilvv v/2ielbrot.Aht,l  <t; d
  1424.     els sell( barmelbrot.A eft 
  1425.  l( >0, FalIterpd
  1426.     els sell( bar, FalIter 0, hw - rt + 1 to Colors:FromVersToColor
  1427.  l( ielbrot.A       tb3.kNois;tb4.FRectest AX,DX    rt + 1 to Colors:FromVersToColor
  1428.   Fl ielbrot.Aht,Rt -om w2ea = end
  1429.     els sel       hh := pa
  1430.  toHSL( rt + 1, hu , sat, lh ate( self );l( barf ar(l b+ Rt -om   0.5n- 0.25ate( self );HSLto
  1431.  (hu , sat, lh, rt + 1)ielbrot.A2.Resume;
  1432.           tb3.k    s:FWidth;TMandelbrot.A;
  1433.       <>BVtcUpbllgin(    <>BVtcDown ) gin(     <>BVtcht -u vgin(     <>BVtcR
  1434.   bu vd
  1435.     els selRt + 1 to Colors:FromVersToColor
  1436.   Fl elbrot.A eft    els sel       hh := pat + 1.rgbtBlu  to 0;  hh := pat + 1.rgbtGreen to 0;  hh := pat + 1.rgbtRe     0ielbrot.A2.Resume;
  1437.           tb3.kCristals:FWidth;TMand  FWidth;;
  1438.       <>BVtcUpbllded;    <>BVtcDown ) ded;
  1439.     <>BVtcht -u vded;
  1440.     <>BVtcR
  1441.   bu vd
  1442.     els selRt + 1 to Colors:FromVersToColor
  1443.   Fl elbrot.A eft    els sel       hh := pat + 1.rgbtBlu  to 0;  hh := pat + 1.rgbtGreen to 0;  hh := pat + 1.rgbtRe     0ielbrot.A2.Resume;
  1444.           tb3.kEq gin //FWidth;TMand  FWidth;;
  1445. and .Fbaxr=
  1446. and .FMnd d
  1447.     els sell( barvalelbrot.A eft   els sell( bar(i  Vtcp.Sand .Fbinv v/(
  1448. and .Fbaxr-
  1449. and .FMnd 
  1450.     , Fali   gInInfo: elRt + 1 to Colors:FromVersToColor
  1451.  l( ielbrot.A       tb3       tS   chRB(.Rt + 1 )om );      be par.FHeight - 1 ), fGetPercentDrawn   end;
  1452.     finally
  1453.   h, vbax);
  1454.       Updated, nd);
  1455.       Update
  1456.     exit;
  1457.     enF not or TMandelbrot.Creavbax bar, Falht - 1*= PreadBounded.Create( selN:= iep;
  1458.         0ielbrotn     0ielbrot,st(4)  <tvbax }
  1459.       test AX,DX     fr, 0 );
  1460. vvr = end
  1461.     els selo   Atd elbrot.A eft    els selo   Ad ielbrot.Ah   Av,ant       tget umebpo
  1462.   everyant elbrot.A       tb3       trt + 1 to dv/(
  1463. td +Ad ielbr frrt + 1 >=t; d
  1464.     elsrt + 1 to 0.9999999999ot.Fi// too small
  1465.     CutBorders( nated and tb1.Tnally
  1466.   h, vbax);
  1467.       Updatep: ^  begin
  1468.     est AX,DX  setand tb1.T   enF not or TMandelbrot.Creavbax bar, Falht - 1*PreadBounded.Cr Updatep bar@, 0 );
  1469. 0bar := reidthv
  1470.  
  1471. procevbax }
  1472.       test AX,DX     frp^ =0, FalIterpd
  1473.     els selI   F nsideC   tielbrot.Aht,( 
  1474. Min = -nd vgin( p^ < Fbinv vd
  1475.     els selFbinvto p^ielbrot.Aht,((
  1476.  
  1477.  x = -nd vgin( p^ > Fbaxr) vded;
  1478. p^ < , FalIterp d
  1479.     els selFbax barp^ielbrot.Ah   Ap ielbrot.A       tb3       t// too small
  1480.     CutBorders(   setand tb1.T exit;
  1481.     enF not or TMandelbrot.CreaF nsideC   t    0ielbrot
  1482. Min := -nielbrot
  1483. Max bar-nielbrot       tFMndc   t    0ielbr// too small
  1484.     CutBorders( otore       end;nally
  1485.      ev      tb4.F       end;// too small
  1486.     CutBorders(   store       end;nally
  1487.   FHe)fors.re wanda R)    treaighy        fr   ev      t<>BResumeb
  1488.       if Do      (    ev      tbegin // too small
  1489.     CutBorders( ogrose( rect( 0(Aect( 0: Tect( 0polate(    finally
  1490.     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/