// Stephen C. Ferguson // 01-23-01 unit ktaza; interface uses Windows, Messages, SysUtils, Classes, Controls, Forms, Dialogs, ExtCtrls, ExtDlgs, Formula, ComCtrls, params, ColorControl, ListZon, LMString, XYSize, MainUnit; procedure GetDLLDescriptions; procedure InitializeMainDLL(pData: Pointer); procedure UpdateFractal; procedure BlendMethods; procedure ApplyColor(qx, qy: Integer); procedure coloring; procedure Reset1Click(Sender: TObject); procedure ResetCoordinates; procedure ChildApplyColors(Sender: TObject); procedure draw_fractal; procedure FormPaint; procedure ReadFromParameterFile; procedure LoadParameters; procedure TP01Click(Sender: TObject); procedure SaveArray(qx, qy: Integer); type //DataArray = array [0..799, 0..599] of Double; DataArray = array [0..1023, 0..767] of Double; implementation var CaptionSave: String; formula_saved: Integer; xtotArray: DataArray; ytotArray: DataArray; strDLLName: PAnsiChar ; ftloo_info : Function (PData: Pointer): Integer; cdecl; ftloo_formula_total : Function : Integer; cdecl; ftloo_fractal : Function (PData: Pointer): Integer; cdecl; nError: Integer; strParamName: String; InFile: TextFile; OutFile: TextFile; InString: String; bAmerican: Bool; sFormulaTitle: array [0..99] of Char; sRenderTitle: array [0..99] of Char; StrTemp: array [0..99] of Char; i: Integer; PData: Pointer; r, g, b, t1, t2, t3: double; red, grn, blu, color: Integer; bug: Integer; px, py, pk: Integer; procedure draw_fractal; begin ftloo_fractal(pData); end; procedure ResetCoordinates; begin if MainForm.v.bAtriatix = True then begin MainForm.v.dMagnification := 0.1; MainForm.v.dMag_new := 0.1; end else begin MainForm.v.dMagnification := 1; MainForm.v.dMag_new := 1; end; MainForm.v.CRMIN := -4; MainForm.v.CRMAX := 4; MainForm.v.CIMIN := -4; MainForm.v.CIMAX := 4; MainForm.v.CRMIN_NEW := -4; MainForm.v.CRMAX_NEW := 4; MainForm.v.CIMIN_NEW := -4; MainForm.v.CIMAX_NEW := 4; MainForm.v.CRMID := ((MainForm.v.CRMAX - MainForm.v.CRMIN) / 2.0) + MainForm.v.CRMIN; MainForm.v.CIMID := ((MainForm.v.CIMAX - MainForm.v.CIMIN) / 2.0) + MainForm.v.CIMIN; end; procedure Reset1Click(Sender: TObject); begin ResetCoordinates; UpdateFractal; end; procedure GetDLLDescriptions; begin nError := ftloo_info(pData); end; procedure TP01Click(Sender: TObject); begin if XYSize1.Visible = True then begin // Resizing the image MainForm.v.iWidth := XYSize1.SpinWidth.Value; MainForm.v.iHeight := XYSize1.SpinHeight.Value; end; MainForm.DrawDefaultImage; UpdateFractal; end; procedure FormPaint; begin if Application.Title = 'NEW' then begin MainForm.Caption := 'Vchira_'; MainForm.v.iHeight := MainForm.v.iHeight; MainForm.v.iWidth := MainForm.v.iWidth; //ClientHeight := MainForm.v.iHeight; //ClientWidth := MainForm.v.iWidth; //VertScrollBar.Range := MainForm.v.iHeight; //HorzScrollBar.Range := MainForm.v.iWidth; //Image1.Canvas.Rectangle(0,0,MainForm.v.iWidth,MainForm.v.iHeight); MainForm.DrawDefaultImage; ResetCoordinates; pData := @MainForm.v; InitializeMainDLL(pData); Application.Title := constVersionNumber; //MainForm.Caption := Application.Title; CaptionSave := MainForm.Caption; UpdateFractal; end else if Application.Title = 'PARAM' then begin // Load from a parameter file MainForm.v.iHeight := constHEIGHT; MainForm.v.iWidth := constWIDTH; MainForm.DrawDefaultImage; MainForm.v.bInitialize := False; LoadParameters; pData := @MainForm.v; InitializeMainDLL(pData); Application.Title := constVersionNumber; MainForm.Caption := Application.Title; ListForm.Visible := False; (* if MainForm.v.bAtriatix = False then begin Atriatix.Visible := False; atr_params1.Visible := False; end else begin Atriatix.Visible := True; atr_params1.Visible := True; end; *) CaptionSave := MainForm.Caption; UpdateFractal; end; end; procedure UpdateFractal; var dMultiPass: double; begin if Params1.Visible = True then begin MainForm.v.Maxit := Params1.SpinMaxIteration.Value; MainForm.DetailsSpinEdit.Value := MainForm.v.Maxit; MainForm.v.ti_Power := Params1.SpinPower.Value; MainForm.v.dFactor4 := Params1.dFactor4.Value; MainForm.v.dFactor5 := Params1.dFactor5.Value; MainForm.v.dStrands := Params1.dStrands.Value; end; MainForm.ClearRectangle; if formula_saved <> MainForm.v.formula then begin MainForm.DrawDefaultImage; ResetCoordinates; formula_saved := MainForm.v.formula; end; MainForm.AdjustCoords; MainForm.UpdateMenus; MainForm.Timer3UpdateFractal.Enabled := True; MainForm.xO := MainForm.v.CRMIN; MainForm.yO := MainForm.v.CIMIN; MainForm.xI := MainForm.v.CRMAX; MainForm.yI := MainForm.v.CIMAX; MainForm.ldx := (MainForm.xI - MainForm.xO) / MainForm.v.iWidth; // compute size of pixels MainForm.ldy := (MainForm.yI - MainForm.yO) / MainForm.v.iHeight; // init image MainForm.AbortButton.Enabled := True; MainForm.v.Abort_Draw := False; MainForm.bValid := True; pk := 0; MainForm.PYGlobal := MainForm.v.iHeight; dMultiPass := MainForm.v.iHeight*MainForm.v.iWidth; while (MainForm.v.Abort_Draw = False) and (pk < 4) do begin py := 0; while (MainForm.v.Abort_Draw = False) and (py < MainForm.v.iHeight) do begin px := pk; while (MainForm.v.Abort_Draw = False) and (px < MainForm.v.iWidth) do begin MainForm.v.xsav := 0; MainForm.v.ysav := 0; MainForm.v.xtot := 0; MainForm.v.ytot := 0; MainForm.v.Iteration := -1; MainForm.v.zx := MainForm.xO + px * MainForm.ldx; // start julia on pixel MainForm.v.zy := MainForm.yO + py * MainForm.ldy; if (MainForm.v.dMagnification > 10) then begin if (abs(MainForm.v.zx) < constZeroTol) then MainForm.v.zx := constZeroTol; if (abs(MainForm.v.zy) < constZeroTol) then MainForm.v.zy := constZeroTol; end else begin if (abs(MainForm.v.zx) < 1e-3) then MainForm.v.zx := 1e-3; if (abs(MainForm.v.zy) < 1e-3) then MainForm.v.zy := 1e-3; end; if MainForm.v.jul = 0 then begin MainForm.v.cx := MainForm.v.zx; MainForm.v.cy := MainForm.v.zy; // use pixel for c. end else if MainForm.v.jul_save = 0 // If previous was a mandelbrot then begin MainForm.v.cx := MainForm.v.CRMID_JUL; MainForm.v.cy := MainForm.v.CIMID_JUL; // A Julia coordinate end; ////////////////////////////////////////////// MainForm.PYGlobal := 100 - Round((1 - dMultiPass/(MainForm.v.iHeight*MainForm.v.iWidth))*100); dMultiPass := dMultiPass - 1; pData := @MainForm.v; if MainForm.v.Abort_Draw = False then DrawFractal(pData); if (MainForm.v.iWidth <= constArrayWidth) and (MainForm.v.iHeight <= constArrayHeight) then begin xtotArray[px, py] := MainForm.v.xtot; ytotArray[px, py] := MainForm.v.ytot; MainForm.v.xtot := MainForm.v.dFactor3*xtotArray[px, py]; MainForm.v.ytot := MainForm.v.dFactor3*ytotArray[px, py]; end else begin MainForm.v.xtot := MainForm.v.dFactor3*MainForm.v.xtot; MainForm.v.ytot := MainForm.v.dFactor3*MainForm.v.ytot; end; BlendMethods; if (MainForm.v.iWidth <= constArrayWidth) and (MainForm.v.iHeight <= constArrayHeight) then begin MainForm.v.xtot := xtotArray[px, py]; MainForm.v.ytot := ytotArray[px, py]; end; case pk of 0: begin SaveArray(px+0, py); SaveArray(px+1, py); SaveArray(px+2, py); SaveArray(px+3, py); SaveArray(px+0, py+1); SaveArray(px+1, py+1); SaveArray(px+2, py+1); SaveArray(px+3, py+1); SaveArray(px+0, py+2); SaveArray(px+1, py+2); SaveArray(px+2, py+2); SaveArray(px+3, py+2); SaveArray(px+0, py+3); SaveArray(px+1, py+3); SaveArray(px+2, py+3); SaveArray(px+3, py+3); end; 1: begin SaveArray(px+0, py); SaveArray(px+1, py); SaveArray(px+2, py); SaveArray(px+0, py+1); SaveArray(px+1, py+1); SaveArray(px+2, py+1); SaveArray(px+0, py+2); SaveArray(px+1, py+2); SaveArray(px+2, py+2); end; 2: begin SaveArray(px+0, py); SaveArray(px+1, py); SaveArray(px+0, py+1); SaveArray(px+1, py+1); end; 3: begin SaveArray(px, py); end; end; px := px + 4; end; if (py and $7) = $7 then Application.ProcessMessages; if MainForm.bValid = False then break; py := py + 1; end; inc(pk); end; MainForm.PYGlobal := 0; MainForm.StatusBar1.SimpleText := 'Ready...'; MainForm.Timer3UpdateFractal.Enabled := False; MainForm.AbortButton.Enabled := False; MainForm.v.jul_save := MainForm.v.jul; MainForm.bValid := False; Mainform.bStartup := True; MainForm.v.Abort_Draw := True; MainForm.Caption := ExtractFileName(CaptionSave); MainForm.ImgView.Invalidate; end; procedure SaveArray(qx, qy: Integer); begin if (qx < MainForm.v.iWidth) and (qy < MainForm.v.iHeight) then begin if (MainForm.v.iWidth <= constArrayWidth) and (MainForm.v.iHeight <= constArrayHeight) then begin xtotArray[qx, qy] := MainForm.v.xtot; ytotArray[qx, qy] := MainForm.v.ytot; end; //BlendMethods; ApplyColor(qx, qy); end; end; procedure ApplyColor(qx, qy: Integer); begin if (qx < MainForm.v.iWidth) and (qy < MainForm.v.iHeight) then begin case MainForm.v.nColoringOrder of 1: MainForm.ImgView.Bitmap.Pixel[qx,qy] := RGB(blu,grn,red); 2: MainForm.ImgView.Bitmap.Pixel[qx,qy] := RGB(red,blu,grn); 3: MainForm.ImgView.Bitmap.Pixel[qx,qy] := RGB(grn,blu,red); 4: MainForm.ImgView.Bitmap.Pixel[qx,qy] := RGB(grn,red,blu); 5: MainForm.ImgView.Bitmap.Pixel[qx,qy] := RGB(blu,red,grn); 6: MainForm.ImgView.Bitmap.Pixel[qx,qy] := RGB(red,grn,blu); else ShowMessage('Wrong coloringorder number'); end; end; end; procedure ChildApplyColors(Sender: TObject); var px, py: Integer; begin if ColorForm.Visible = True then begin MainForm.v.dRedStep := ColorForm.RedStep.Value; MainForm.v.dGrnStep := ColorForm.GrnStep.Value; MainForm.v.dBluStep := ColorForm.BluStep.Value; MainForm.v.dRedStart := ColorForm.RedStart.Value; MainForm.v.dGrnStart := ColorForm.GrnStart.Value; MainForm.v.dBluStart := ColorForm.BluStart.Value; MainForm.v.dRedSaturate := ColorForm.RedSaturate.Value; MainForm.v.dGrnSaturate := ColorForm.GrnSaturate.Value; MainForm.v.dBluSaturate := ColorForm.BluSaturate.Value; MainForm.v.dRedOffset := ColorForm.RedOffset.Value; MainForm.v.dGrnOffset := ColorForm.GrnOffset.Value; MainForm.v.dBluOffset := ColorForm.BluOffset.Value; MainForm.v.dFactor3 := ColorForm.dFactor3.Value; MainForm.IntensityRxSpinEdit.Value := MainForm.v.dFactor3; end; if (MainForm.v.iWidth <= constArrayWidth) and (MainForm.v.iHeight <= constArrayHeight) then // and MainForm.bValid = False then begin for py := 0 to MainForm.v.iHeight-1 do begin for px := 0 to MainForm.v.iWidth-1 do begin MainForm.v.xtot := MainForm.v.dFactor3*xtotArray[px, py]; MainForm.v.ytot := MainForm.v.dFactor3*ytotArray[px, py]; BlendMethods; ApplyColor(px, py); end; end; MainForm.ImgView.Invalidate; end else UpdateFractal; MainForm.UpdateMenus; end; procedure BlendMethods; begin //MainForm.v.xtot := MainForm.v.dFactor3*xtotArray[px, py]; //MainForm.v.ytot := MainForm.v.dFactor3*ytotArray[px, py]; case MainForm.v.nBlendingMethod of 1: begin r := MainForm.v.xtot; g := MainForm.v.ytot; b := (r+g)*0.5; t1 := sin(const2PI*r); t2 := sin(const2PI*g); t3 := sin(const2PI*b); end; 2: begin r := MainForm.v.xtot; g := MainForm.v.ytot; b := (r+g)*0.5; t1 := -cos(const2PI*r); t2 := -cos(const2PI*g); t3 := -cos(const2PI*b); t1 := t1*MainForm.v.dRedSaturate + MainForm.v.dRedOffset; t2 := t2*MainForm.v.dGrnSaturate + MainForm.v.dGrnOffset; t3 := t3*MainForm.v.dBluSaturate + MainForm.v.dBluOffset; t1 := MainForm.v.dRedStart + t1 * MainForm.v.dRedStep; t2 := MainForm.v.dGrnStart + t2 * MainForm.v.dGrnStep; t3 := MainForm.v.dBluStart + t3 * MainForm.v.dBluStep; t1 := t1/255; t2 := t2/255; t3 := t3/255; t1 := (t2+t3)*0.5; t2 := (t3+t1)*0.5; t3 := (t1+t2+t3)*0.33; t1 := cos(const2PI*t1); t2 := cos(const2PI*t2); t3 := cos(const2PI*t3); end; 3: begin b := MainForm.v.xtot; r := MainForm.v.ytot; g := (r+b)*0.5; t1 := sin(const2PI*r); t2 := sin(const2PI*g); t3 := sin(const2PI*b); t1 := t1*MainForm.v.dRedSaturate + MainForm.v.dRedOffset; t2 := t2*MainForm.v.dGrnSaturate + MainForm.v.dGrnOffset; t3 := t3*MainForm.v.dBluSaturate + MainForm.v.dBluOffset; t1 := MainForm.v.dRedStart + t1 * MainForm.v.dRedStep; t2 := MainForm.v.dGrnStart + t2 * MainForm.v.dGrnStep; t3 := MainForm.v.dBluStart + t3 * MainForm.v.dBluStep; t1 := t1/255; t2 := t2/255; t3 := t3/255; t1 := (t2+t3)*0.5; t2 := (t3+t1)*0.5; t3 := (t1+t2+t3)*0.33; t1 := sin(const2PI*t1); t2 := sin(const2PI*t2); t3 := sin(const2PI*t3); end; 4: begin b := MainForm.v.xtot; r := MainForm.v.ytot; g := (r+b)*0.5; t1 := sin(const2PI*r); t2 := sin(const2PI*g); t3 := sin(const2PI*b); t1 := t1*MainForm.v.dRedSaturate + MainForm.v.dRedOffset; t2 := t2*MainForm.v.dGrnSaturate + MainForm.v.dGrnOffset; t3 := t3*MainForm.v.dBluSaturate + MainForm.v.dBluOffset; t1 := MainForm.v.dRedStart + t1 * MainForm.v.dRedStep; t2 := MainForm.v.dGrnStart + t2 * MainForm.v.dGrnStep; t3 := MainForm.v.dBluStart + t3 * MainForm.v.dBluStep; t1 := 255 - t1; t2 := 255 - t2; t3 := 255 - t3; t1 := t1/255; t2 := t2/255; t3 := t3/255; t1 := cos(const2PI*t1); t2 := cos(const2PI*t2); t3 := cos(const2PI*t3); end; 5: begin r := MainForm.v.xtot; g := MainForm.v.ytot; b := (r+g)*0.5; t1 := -sin(const2PI*r); t2 := -sin(const2PI*g); t3 := -sin(const2PI*b); t1 := t1*MainForm.v.dRedSaturate + MainForm.v.dRedOffset; t2 := t2*MainForm.v.dGrnSaturate + MainForm.v.dGrnOffset; t3 := t3*MainForm.v.dBluSaturate + MainForm.v.dBluOffset; t1 := MainForm.v.dRedStart + t1 * MainForm.v.dRedStep; t2 := MainForm.v.dGrnStart + t2 * MainForm.v.dGrnStep; t3 := MainForm.v.dBluStart + t3 * MainForm.v.dBluStep; t1 := t1/255; t2 := t2/255; t3 := t3/255; t1 := (t2+t3)*0.5; t2 := (t3+t1)*0.5; t3 := (t1+t2+t3)*0.33; t1 := sin(const2PI*t1); t2 := sin(const2PI*t2); t3 := sin(const2PI*t3); end; 6: begin r := MainForm.v.xtot*1000; g := MainForm.v.ytot*1000; color := abs(Round(r) - Round(g)); red := Round(r); grn := Round(g); if (color < 0) then ShowMessage('color bug,...'); begin if ((red and $1FF) > $FF) then red := (not red) and $FF // Invert the color else red := red and $FF; end; begin if ((grn and $1FF) > $FF) then grn := (not grn) and $FF // Invert the color else grn := grn and $FF; end; begin if ((color and $1FF) > $FF) then blu := (not color) and $FF // Invert the color else blu := color and $FF; end; if (red > 255) or (red < 0) then ShowMessage('red bug'); if (grn > 255) or (grn < 0) then ShowMessage('grn bug'); if (blu > 255) or (blu < 0) then ShowMessage('blu bug'); t1 := red; t2 := grn; t3 := blu; t1 := t1/255; t2 := t2/255; t3 := t3/255; end; end; coloring; end; //------------------------------------------------// procedure coloring; begin t1 := t1*MainForm.v.dRedSaturate + MainForm.v.dRedOffset; t2 := t2*MainForm.v.dGrnSaturate + MainForm.v.dGrnOffset; t3 := t3*MainForm.v.dBluSaturate + MainForm.v.dBluOffset; t1 := MainForm.v.dRedStart + t1 * MainForm.v.dRedStep; t2 := MainForm.v.dGrnStart + t2 * MainForm.v.dGrnStep; t3 := MainForm.v.dBluStart + t3 * MainForm.v.dBluStep; t1 := t1/255; t2 := t2/255; t3 := t3/255; r := cos(const2PI*t1); g := cos(const2PI*t2); b := cos(const2PI*t3); //////// red := Round(r*127) + 127; grn := Round(g*127) + 127; blu := Round(b*127) + 127; if (red > 255) or (grn > 255) or (blu > 255) then begin ShowMessage('bug 1'); bug := 1; end; if (red < 0) or (grn < 0) or (blu < 0) then begin ShowMessage('bug 2'); bug := 1; end; end; procedure InitializeMainDLL(pData: Pointer); begin strDLLName := 'ftloo01.tza'; MainForm.v.szFormulaFile := strDLLName; MainForm.v.hDLLHandle := LoadLibrary(strDLLName); if MainForm.v.hDLLHandle = 0 then begin ShowMessage('Error loading DLL: ' + strDLLName); Application.Title := 'ERROR'; end else begin @ftloo_formula_total := GetProcAddress(MainForm.v.hDLLHandle,'_total'); MainForm.v.formula_total := ftloo_formula_total(); if MainForm.v.formula_total = 0 then begin ShowMessage('Error, Total formula = 0'); end; @ftloo_fractal := GetProcAddress(MainForm.v.hDLLHandle,'_formula'); @ftloo_info := GetProcAddress(MainForm.v.hDLLHandle,'_info'); ftloo_info(pData); end; end; procedure ReadFromParameterFile; begin if MainForm.bValid = True then begin ReadLn(InFile, InString); if InString = '' then begin //ShowMessage('Missing variable in parameter file: ' + Caption + ' using defaults'); MainForm.bValid := False; //Abort_Draw := True; //Close; end; if bAmerican = True then InString := StrReplaceAll(InString, ',', '.') else InString := StrReplaceAll(InString, '.', ','); end; end; procedure LoadParameters; begin ////// // Test for commas or decimal points in floting point numbers // European software writes and reads floting point with commas // instead of decimal points //Identify the filename and type as OutFile AssignFile(OutFile, 'kta_-_-_.tmp'); // Open and create the param file Rewrite(OutFile); // Write the magnification WriteLn(OutFile, FloatToStr(2.0/3.0)); CloseFile(OutFile); // Identify the TextFile as InFile AssignFile(OutFile, 'kta_-_-_.tmp'); // Open the file identified with InFile Reset(OutFile); //PtrString := InString; ReadLn(OutFile, StrTemp); if StrScan(StrTemp, '.') <> nil then bAmerican := True else bAmerican := False; CloseFile(OutFile); DeleteFile('kta_-_-_.tmp'); ////////////////////////////////// ////// MainForm.Caption := ExtractFileName(MainForm.Caption); // Identify the TextFile as InFile AssignFile(InFile, MainForm.Caption); // Open the file identified with InFile Reset(InFile); strParamName := MainForm.Caption; Delete(strParamName, Length(strParamName)-3, 4); MainForm.Caption := strParamName; Application.Title := MainForm.Caption; try MainForm.bValid := True; // Start Reading in the parameters (* ReadLn(InFile, sFormulaFile); MainForm.v.szFormulaFile := sFormulaFile; ReadLn(InFile, sRenderFile); MainForm.v.szRenderFile := sRenderFile; *) ReadLn(InFile, InString); //szFilterFile := sFilterFile; // Read the formula number ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.formula := StrToInt(InString); // Read the render number ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.render := StrToInt(InString); ReadFromParameterFile; // reserved //if bValid = True then //MainForm.v.filter := StrToInt(InString); // Read the Titles ReadLn(InFile, sFormulaTitle); MainForm.v.StrTitle := sFormulaTitle; ReadLn(InFile, sRenderTitle); MainForm.v.StrDescription := sRenderTitle; ReadLn(InFile, InString); //StrFilter := sFilterTitle; // Read the magnification ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.dMagnification := StrToFloat(InString); // Read CRMID, and CRMAX ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.CRMID := StrToFloat(InString); ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.CRMAX := StrToFloat(InString); // Read CIMID, and CIMAX ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.CIMID := StrToFloat(InString); ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.CIMAX := StrToFloat(InString); // Read color parameters ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.dRedStart := StrToFloat(InString); ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.dGrnStart := StrToFloat(InString); ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.dBluStart := StrToFloat(InString); ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.dRedStep := StrToFloat(InString); ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.dGrnStep := StrToFloat(InString); ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.dBluStep := StrToFloat(InString); // Read the Fractal Type ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.FractalType := StrToInt(InString); // Read the Max Iterations ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.Maxit := StrToInt(InString); // Read the Blending Method ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.nBlendingMethod := StrToInt(InString) else begin MainForm.v.nBlendingMethod := 1; MainForm.bValid := True; end; if MainForm.v.nBlendingMethod > 26 then begin ShowMessage('blending .gt. 26, setting 1'); MainForm.v.nBlendingMethod := 1; end; // Read the Coloring Order ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.nColoringOrder := StrToInt(InString) else begin MainForm.v.nColoringOrder := 1; MainForm.bValid := True; end; // Read dFactor3 and dFactor4 ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.dFactor3 := StrToFloat(InString) else begin MainForm.v.dFactor3 := 2; MainForm.bValid := True; end; ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.dFactor4 := StrToFloat(InString) else begin MainForm.v.dFactor4 := 2; MainForm.bValid := True; end; ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.dFactor5 := StrToFloat(InString) else begin MainForm.v.dFactor5 := 8; MainForm.bValid := True; end; // read the dStrands ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.dStrands := StrToFloat(InString) else begin MainForm.v.dStrands := 0.05; MainForm.bValid := True; end; // Read the M-Set Bailout ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.Bailout := StrToInt(InString) else begin MainForm.v.Bailout := 4; MainForm.bValid := True; end; // Read the jul variable ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.jul := StrToInt(InString) else begin MainForm.v.jul := 0; MainForm.bValid := True; end; // Read the jul_save variable ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.jul_save := StrToInt(InString) else begin MainForm.v.jul_save := 0; MainForm.bValid := True; end; // Read the inverse variable ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.inverse := StrToInt(InString) else begin MainForm.v.inverse := 0; MainForm.bValid := True; end; // read the CRMID_JUL coordinate ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.CRMID_JUL := StrToFloat(InString) else begin MainForm.v.CRMID_JUL := 0.0; MainForm.bValid := True; end; // read the CRMID_JUL coordinate ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.CIMID_JUL := StrToFloat(InString) else begin MainForm.v.CIMID_JUL := 0.0; MainForm.bValid := True; end; MainForm.v.cx := MainForm.v.CRMID_JUL; MainForm.v.cy := MainForm.v.CIMID_JUL; // A Julia coordinate // Read the nRotation variable ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.nRotation := StrToInt(InString) else begin MainForm.v.nRotation := 0; MainForm.bValid := True; end; // Read more color parameters ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.dRedSaturate := StrToFloat(InString) else begin MainForm.v.dRedSaturate := 127; MainForm.bValid := True; end; ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.dGrnSaturate := StrToFloat(InString) else begin MainForm.v.dGrnSaturate := 127; MainForm.bValid := True; end; ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.dBluSaturate := StrToFloat(InString) else begin MainForm.v.dBluSaturate := 127; MainForm.bValid := True; end; ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.dRedOffset := StrToFloat(InString) else begin MainForm.v.dRedOffset := 127; MainForm.bValid := True; end; ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.dGrnOffset := StrToFloat(InString) else begin MainForm.v.dGrnOffset := 127; MainForm.bValid := True; end; ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.dBluOffset := StrToFloat(InString) else begin MainForm.v.dBluOffset := 127; MainForm.bValid := True; end; // Read the lmapping variable ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.lmapping := StrToInt(InString) else begin MainForm.v.lmapping := 1; MainForm.bValid := True; end; // Read the derivative variable ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.derivative := StrToInt(InString) else begin MainForm.v.derivative := 1; MainForm.bValid := True; end; // Read the nTransform variable ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.nTransform := StrToInt(InString) else begin MainForm.v.nTransform := 0; MainForm.bValid := True; end; // read the power variable for triangle inequality ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.ti_power := StrToFloat(InString) else begin MainForm.v.ti_power := 2; MainForm.bValid := True; end; /////////////////////////////////////////////// // read additional parameters for atriatix // Read the magnification1 ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.dMagnification1 := StrToFloat(InString); // Read CRMID, and CRMAX ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.CRMID1 := StrToFloat(InString); ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.CRMAX1 := StrToFloat(InString); // Read CIMID, and CIMAX ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.CIMID1 := StrToFloat(InString); ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.CIMAX1 := StrToFloat(InString); // Read dFactor1 ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.dFactor1 := StrToFloat(InString) else begin MainForm.bValid := True; end; // Read dFactor2 ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.dFactor2 := StrToFloat(InString) else begin MainForm.bValid := True; end; // Read RandomFactor ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.RandomFactor := StrToFloat(InString) else begin MainForm.bValid := True; end; // read bSqrt bool variable ReadFromParameterFile; if MainForm.bValid = True then if InString = '1' then MainForm.v.bSqrt := True else MainForm.v.bSqrt := False; // read in the coefficiants i := 1; while (i <= 60) do begin ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.af[i] := StrToFloat(InString) else begin MainForm.bValid := True; end; ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.bf[i] := StrToFloat(InString) else begin MainForm.bValid := True; end; inc(i); end; // Read the Gumowski - Mira coefficiants AA ReadFromParameterFile; if MainForm.bValid = True then begin MainForm.v.AA_Initial := StrToFloat(InString); MainForm.v.AA := MainForm.v.AA_Initial; end; // Read the Gumowski - Mira coefficiants BB ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.BB := StrToFloat(InString); // read bColorMix bool variable ReadFromParameterFile; if MainForm.v.bColorMix = True then if InString = '1' then MainForm.v.bColorMix := True else MainForm.v.bColorMix := False; // read bExpansion bool variable ReadFromParameterFile; if MainForm.v.bExpansion = True then if InString = '1' then MainForm.v.bExpansion := True else MainForm.v.bExpansion := False; // read bModulas bool variable ReadFromParameterFile; if MainForm.v.bModulas = True then if InString = '1' then MainForm.v.bModulas := True else MainForm.v.bModulas := False; ReadFromParameterFile; if MainForm.bValid = True then if InString = '1' then MainForm.v.bNone := True else MainForm.v.bNone := False; ReadFromParameterFile; if MainForm.bValid = True then if InString = '1' then MainForm.v.bLinear := True else MainForm.v.bLinear := False; ReadFromParameterFile; if MainForm.bValid = True then if InString = '1' then MainForm.v.bSinusoidal := True else MainForm.v.bSinusoidal := False; ReadFromParameterFile; if MainForm.bValid = True then if InString = '1' then MainForm.v.bSpherical := True else MainForm.v.bSpherical := False; ReadFromParameterFile; if MainForm.bValid = True then if InString = '1' then MainForm.v.bSwirl := True else MainForm.v.bSwirl := False; ReadFromParameterFile; if MainForm.bValid = True then if InString = '1' then MainForm.v.bHorseshoe := True else MainForm.v.bHorseshoe := False; ReadFromParameterFile; if MainForm.bValid = True then if InString = '1' then MainForm.v.bPolar := True else MainForm.v.bPolar := False; ReadFromParameterFile; if MainForm.bValid = True then if InString = '1' then MainForm.v.bBent := True else MainForm.v.bBent := False; ReadFromParameterFile; if MainForm.bValid = True then if InString = '1' then MainForm.v.bInversion := True else MainForm.v.bInversion := False; ReadFromParameterFile; if MainForm.bValid = True then begin if InString = '1' then MainForm.v.bAtriatix := True else MainForm.v.bAtriatix := False; end else begin MainForm.v.bAtriatix := True end; ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.dRedStep1 := StrToFloat(InString); ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.dGrnStep1 := StrToFloat(InString); ReadFromParameterFile; if MainForm.bValid = True then MainForm.v.dBluStep1 := StrToFloat(InString); //////////////////////////// MainForm.bValid := False; formula_saved := MainForm.v.formula; MainForm.IntensityRxSpinEdit.Value := Mainform.v.dFactor3; MainForm.DetailsSpinEdit.Value := MainForm.v.Maxit; except ShowMessage('Error reading parameter file'); end; CloseFile(InFile); //Atriatix.Parameters1Update; //Atriatix.ApplyParameters; //atr_params1.UpdateMenuItems; end; ////////////////////////////////////////////////////// end.