diff --git a/2.10/Source/Adjust.dfm b/2.10/Source/Adjust.dfm index ddfffef..8662091 100644 --- a/2.10/Source/Adjust.dfm +++ b/2.10/Source/Adjust.dfm @@ -182,7 +182,7 @@ object AdjustForm: TAdjustForm Top = 132 Width = 388 Height = 129 - ActivePage = TabSheet3 + ActivePage = TabSheet2 Align = alBottom Images = MainForm.Buttons TabOrder = 1 @@ -511,6 +511,34 @@ object AdjustForm: TAdjustForm OnMouseMove = DragPanelMouseMove OnMouseUp = DragPanelMouseUp end + object pnlGammaThreshold: TPanel + Left = 232 + Top = 76 + Width = 106 + Height = 21 + Cursor = crHandPoint + Hint = 'Click and drag to change value' + BevelOuter = bvLowered + Caption = 'Gamma Threshold' + ParentShowHint = False + ShowHint = True + TabOrder = 11 + OnDblClick = DragPanelDblClick + OnMouseDown = DragPanelMouseDown + OnMouseMove = DragPanelMouseMove + OnMouseUp = DragPanelMouseUp + end + object txtGammaThreshold: TEdit + Left = 338 + Top = 76 + Width = 41 + Height = 21 + TabOrder = 12 + Text = '0' + OnEnter = txtGammaThresholdEnter + OnExit = txtGammaThresholdExit + OnKeyPress = txtGammaThresholdKeyPress + end end object TabSheet3: TTabSheet Caption = 'Gradient' diff --git a/2.10/Source/Adjust.pas b/2.10/Source/Adjust.pas index af26dc3..480b7ca 100644 --- a/2.10/Source/Adjust.pas +++ b/2.10/Source/Adjust.pas @@ -135,6 +135,8 @@ type Bevel3: TBevel; pnlMasterScale: TPanel; editPPU: TEdit; + pnlGammaThreshold: TPanel; + txtGammaThreshold: TEdit; procedure FormCreate(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormDestroy(Sender: TObject); @@ -264,6 +266,9 @@ type procedure PreviewImageMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure PreviewImageDblClick(Sender: TObject); + procedure txtGammaThresholdKeyPress(Sender: TObject; var Key: Char); + procedure txtGammaThresholdEnter(Sender: TObject); + procedure txtGammaThresholdExit(Sender: TObject); private Resetting: boolean; @@ -401,6 +406,8 @@ begin Resetting := False; editPPU.Text := Format('%.6g', [100*cp.pixels_per_unit/PreviewImage.Width]); + + txtGammaThreshold.Text := Format('%.3g', [cp.gamma_threshold]); end; //*** DrawPreview; end; @@ -1938,9 +1945,10 @@ begin except exit; end; - if v > 0 then begin + v := v/100*PreviewImage.Width; + if (v > 0) and (cp.pixels_per_unit <> v) then begin MainForm.UpdateUndo; - cp.pixels_per_unit := v/100*PreviewImage.Width; + cp.pixels_per_unit := v; UpdateFlame; end; end; @@ -1968,6 +1976,8 @@ begin pnlDragValue := cp.brightness else if (Sender = pnlVibrancy) then pnlDragValue := cp.vibrancy + else if (Sender = pnlGammaThreshold) then + pnlDragValue := cp.gamma_threshold else assert(false); pnlDragMode := true; @@ -2040,6 +2050,12 @@ begin else if (Sender = pnlVibrancy) then begin scrollVibrancy.Position := trunc(v * 100); + end + else if (Sender = pnlGammaThreshold) then + begin + if v < 0 then v := 0; + cp.gamma_threshold := v; + txtGammaThreshold.Text := FloattoStr(v); end; //pEdit^.Text := FloatToStr(v); //pEdit.Refresh; @@ -2097,15 +2113,21 @@ begin end else if (Sender = pnlGamma) then begin - scrollGamma.Position := 400; + scrollGamma.Position := Round(defGamma * 100); end else if (Sender = pnlBrightness) then begin - scrollBrightness.Position := 400; + scrollBrightness.Position := Round(defBrightness * 100); end else if (Sender = pnlVibrancy) then begin - scrollVibrancy.Position := 100; + scrollVibrancy.Position := Round(defVibrancy * 100); + end + else if (Sender = pnlGammaThreshold) then + begin + if cp.gamma_threshold = defGammaThreshold then exit; + cp.gamma_threshold := defGammaThreshold; + txtGammaThreshold.Text := FloatToStr(defGammaThreshold); end else assert(false); @@ -2219,5 +2241,38 @@ begin UpdateFlame; end; +procedure TAdjustForm.txtGammaThresholdEnter(Sender: TObject); +begin + EditBoxValue := txtGammaThreshold.Text; +end; + +procedure TAdjustForm.txtGammaThresholdExit(Sender: TObject); +var + v: double; +begin + try + v := strtofloat(txtGammaThreshold.Text); + except + exit; + end; + if v < 0 then v := 0; + if v <> cp.gamma_threshold then begin + MainForm.UpdateUndo; + cp.gamma_threshold := v; + UpdateFlame; + EditBoxValue := txtGammaThreshold.Text; + end; +end; + +procedure TAdjustForm.txtGammaThresholdKeyPress(Sender: TObject; + var Key: Char); +begin + if key=#13 then + begin + key := #0; + txtGammaThresholdExit(Sender); + end; +end; + end. diff --git a/2.10/Source/ControlPoint.pas b/2.10/Source/ControlPoint.pas index 750e2d1..ebf41f6 100644 --- a/2.10/Source/ControlPoint.pas +++ b/2.10/Source/ControlPoint.pas @@ -127,7 +127,7 @@ type estimator, estimator_min, estimator_curve: double; // density estimator. jitters: integer; - gamma_treshold: double; + gamma_threshold: double; // PropTable: array of TXForm; FAngle: Double; @@ -269,7 +269,7 @@ begin estimator_min := 0.0; estimator_curve := 0.4; jitters := 1; - gamma_treshold := 0.01; + gamma_threshold := defGammaThreshold; FTwoColorDimensions := False; @@ -437,7 +437,6 @@ end; xf := xform[0];//random(NumXForms)]; for i := 0 to FUSE do begin xf := xf.PropTable[Random(PROP_TABLE_SIZE)]; - //if xf.RetraceXform then continue; xf.NextPoint(p); end; @@ -866,10 +865,7 @@ begin end else if AnsiCompareText(CurrentToken, 'plotmode') = 0 then begin Inc(ParsePos); - xform[CurrentXForm].noPlot := (ParseValues[ParsePos] = '1'); -// end else if AnsiCompareText(CurrentToken, 'retrace') = 0 then begin -// Inc(ParsePos); -// xform[CurrentXForm].RetraceXform := (ParseValues[ParsePos] = '1'); + xform[CurrentXForm].noPlot := (StrToInt(ParseValues[ParsePos]) = 1); end else begin OutputDebugString(Pchar('Unknown Token: ' + CurrentToken)); end; @@ -1600,7 +1596,6 @@ begin sl.Add(s); sl.Add(Format('plotmode %d', [Ifthen(noPlot, 1, 0)])); -// sl.Add(Format('retrace %d', [Ifthen(RetraceXform, 1, 0)])); end; DecimalSeparator := OldDecimalSperator; @@ -1622,6 +1617,7 @@ begin Result.nick := nick; Result.url := url; Result.Transparency := Transparency; + Result.gamma_threshold := gamma_threshold; for i := 0 to NXFORMS - 1 do Result.xform[i].assign(xform[i]); @@ -1653,6 +1649,7 @@ begin name := cp1.name; nick := cp1.nick; url := cp1.url; + gamma_threshold := cp1.gamma_threshold; if KeepSizes then AdjustScale(w, h); diff --git a/2.10/Source/Editor.pas b/2.10/Source/Editor.pas index 21ed392..6bdcf6c 100644 --- a/2.10/Source/Editor.pas +++ b/2.10/Source/Editor.pas @@ -358,7 +358,8 @@ type procedure mnuChaosSetAllClick(Sender: TObject); procedure mnuLinkPostxformClick(Sender: TObject); procedure chkXformSoloClick(Sender: TObject); -// procedure chkRetraceClick(Sender: TObject); +// procedure btnInvisibleClick(Sender: TObject); +// procedure btnSoloClick(Sender: TObject); private TriangleView: TCustomDrawControl; @@ -835,8 +836,6 @@ begin chkXformInvisible.Enabled := true; chkXformInvisible.Checked := noPlot; chkXformSolo.Enabled := true; -// chkRetrace.Enabled := not noPlot; -// chkRetrace.Checked := RetraceXform; if cp.soloXform >= 0 then begin chkXformSolo.Checked := true; chkXformSolo.Caption := Format('Solo transform #%d', [cp.soloXform + 1]); @@ -1065,7 +1064,6 @@ begin modWeights[Transforms-1] := 1; end; // - if t = (Transforms - 1) then begin MainTriangles[t] := MainTriangles[Transforms]; @@ -1679,9 +1677,6 @@ begin vleVariables.InsertRow(GetVariableNameAt(i), '0', True); end; -// for i:= 0 to NXFORMS - 1 do begin -// vleChaos.InsertRow(inttostr(i + 1), '1', True); -// end; vleChaos.InsertRow('to 1', '1', true); GraphZoom := 1; @@ -3326,7 +3321,7 @@ begin if Sender = VEVars then begin v := cp.xform[SelectedTriangle].vars[n]; - cp.xform[SelectedTriangle].vars[n] := IfThen(DoubleClickSetVars and (v = 0), 1, 0); + cp.xform[SelectedTriangle].vars[n] := IfThen(v = 0, 1, 0); //VEVars.Values[VarNames(n)] := '0'; changed := (cp.xform[SelectedTriangle].vars[n] <> v); end @@ -3622,6 +3617,15 @@ begin Ord('P'): btnPickPivotClick(Sender); Ord('T'): tbPostXswapClick(Sender); + Ord('I'): // Invisible + begin + chkXformInvisible.Checked := not chkXformInvisible.Checked; + end; + Ord('S'): // Solo + begin + chkXformSolo.Checked := not chkXformSolo.Checked; + end; + 189: // "-" begin GraphZoom := GraphZoom * 0.8; @@ -4918,7 +4922,7 @@ begin noEdit := false; break; end; - end; + end; if noEdit then exit; Mainform.UpdateUndo; @@ -4948,7 +4952,7 @@ begin noEdit := false; break; end; - end; + end; if noEdit then exit; Mainform.UpdateUndo; @@ -5013,15 +5017,32 @@ begin end; { -procedure TEditForm.chkRetraceClick(Sender: TObject); +procedure TEditForm.btnInvisibleClick(Sender: TObject); var - newValue: boolean; + newMode: boolean; begin - if (SelectedTriangle < Transforms) then begin - newValue := chkRetrace.Checked; - if cp.xform[SelectedTriangle].RetraceXform <> newValue then begin + if (SelectedTriangle < Transforms) then + begin + newMode := btnInvisible.Down; + if cp.xform[SelectedTriangle].noPlot <> newMode then begin MainForm.UpdateUndo; - cp.xform[SelectedTriangle].RetraceXform := newValue; + cp.xform[SelectedTriangle].noPlot := newMode; + UpdateFlame(true); + end; + end; +end; + +procedure TEditForm.btnSoloClick(Sender: TObject); +begin + if btnSolo.Down <> (cp.soloXform >=0) then begin + if btnSolo.Down then begin + if (SelectedTriangle < Transforms) then begin + cp.soloXform := SelectedTriangle; + UpdateFlame(true); + end; + end + else begin + cp.soloXform := -1; UpdateFlame(true); end; end; diff --git a/2.10/Source/FormExport.dfm b/2.10/Source/FormExport.dfm index eed8705..18db7d5 100644 --- a/2.10/Source/FormExport.dfm +++ b/2.10/Source/FormExport.dfm @@ -289,9 +289,9 @@ object ExportDialog: TExportDialog object Label14: TLabel Left = 160 Top = 16 - Width = 39 + Width = 43 Height = 26 - Caption = 'Gamma treshold' + Caption = 'Gamma threshold' WordWrap = True end object cmbDepth: TComboBox diff --git a/2.10/Source/FormExport.pas b/2.10/Source/FormExport.pas index 0f0b059..5dd7975 100644 --- a/2.10/Source/FormExport.pas +++ b/2.10/Source/FormExport.pas @@ -146,7 +146,7 @@ begin EstimatorMin := 0.0; EstimatorCurve := 0.4; Jitters := 1; - GammaTreshold := 0.01; + GammaTreshold := MainCP.gamma_threshold; //0.01; GetLocaleFormatSettings(LOCALE_SYSTEM_DEFAULT, FloatFormatSettings); txtEstimator.Text := FloatToStr(Estimator, FloatFormatSettings); txtEstimatorMin.Text := FloatToStr(EstimatorMin, FloatFormatSettings); @@ -287,7 +287,7 @@ end; procedure TExportDialog.txtGammaTresholdChange(Sender: TObject); begin - GammaTreshold := 0.01; + //GammaTreshold := 0.01; try GammaTreshold := StrToFloat(txtGammaTreshold.Text, FloatFormatSettings); except diff --git a/2.10/Source/Global.pas b/2.10/Source/Global.pas index 0b18144..0a2b8a6 100644 --- a/2.10/Source/Global.pas +++ b/2.10/Source/Global.pas @@ -96,13 +96,13 @@ var EditorBkgColor, ReferenceTriangleColor: integer; GridColor1, GridColor2, HelpersColor: integer; ExtEditEnabled, TransformAxisLock: boolean; - DoubleClickSetVars: boolean; ShowAllXforms: boolean; { Display } defSampleDensity, defPreviewDensity: Double; - defGamma, defBrightness, defVibrancy, defFilterRadius: Double; + defGamma, defBrightness, defVibrancy, + defFilterRadius, defGammaThreshold: Double; defOversample: integer; { Render } diff --git a/2.10/Source/ImageMaker.pas b/2.10/Source/ImageMaker.pas index b17022e..694b806 100644 --- a/2.10/Source/ImageMaker.pas +++ b/2.10/Source/ImageMaker.pas @@ -254,6 +254,7 @@ var gutter_width: integer; k1, k2: double; area: double; + frac, funcval: double; GetBucket: function(x, y: integer): TBucket64 of object; bucket: TBucket64; @@ -267,6 +268,9 @@ begin vib := round(fcp.vibrancy * 256.0); notvib := 256 - vib; + if fcp.gamma_threshold <> 0 then + funcval := power(fcp.gamma_threshold, gamma - 1); { / fcp.gamma_threshold; } + bgi[0] := round(fcp.background[0]); bgi[1] := round(fcp.background[1]); bgi[2] := round(fcp.background[2]); @@ -352,8 +356,15 @@ begin Inc(bx, FOversample); if fcp.Transparency then begin // -------------------------- Transparency + // gamma linearization if (fp[3] > 0.0) then begin - alpha := power(fp[3], gamma); + if fp[3] <= fcp.gamma_threshold then begin + frac := fp[3] / fcp.gamma_threshold; + alpha := (1 - frac) * fp[3] * funcval + frac * power(fp[3], gamma); + end + else + alpha := power(fp[3], gamma); + ls := vib * alpha / fp[3]; ai := round(alpha * 256); if (ai <= 0) then goto zero_alpha // ignore all if alpha = 0 @@ -399,7 +410,14 @@ zero_alpha: end else begin // ------------------------------------------- No transparency if (fp[3] > 0.0) then begin - alpha := power(fp[3], gamma); + // gamma linearization + if fp[3] <= fcp.gamma_threshold then begin + frac := fp[3] / fcp.gamma_threshold; + alpha := (1 - frac) * fp[3] * funcval + frac * power(fp[3], gamma); + end + else + alpha := power(fp[3], gamma); + ls := vib * alpha / fp[3]; ai := round(alpha * 256); if (ai < 0) then ai := 0 diff --git a/2.10/Source/Main.dfm b/2.10/Source/Main.dfm index d8aaa5d..ae17299 100644 --- a/2.10/Source/Main.dfm +++ b/2.10/Source/Main.dfm @@ -31,7 +31,7 @@ object MainForm: TMainForm Left = 160 Top = 28 Width = 4 - Height = 435 + Height = 430 end object ToolBar: TToolBar Left = 0 @@ -72,7 +72,6 @@ object MainForm: TMainForm Left = 69 Top = 0 Width = 8 - Caption = 'ToolButton9' ImageIndex = 8 Style = tbsSeparator end @@ -98,7 +97,6 @@ object MainForm: TMainForm Left = 123 Top = 0 Width = 8 - Caption = 'ToolButton1' ImageIndex = 18 Style = tbsSeparator end @@ -142,7 +140,6 @@ object MainForm: TMainForm Left = 217 Top = 0 Width = 8 - Caption = 'ToolButton3' ImageIndex = 8 Style = tbsSeparator end @@ -190,7 +187,6 @@ object MainForm: TMainForm Left = 340 Top = 0 Width = 8 - Caption = 'ToolButton4' ImageIndex = 14 Style = tbsSeparator end @@ -222,7 +218,6 @@ object MainForm: TMainForm Left = 417 Top = 0 Width = 8 - Caption = 'ToolButton5' ImageIndex = 42 Style = tbsSeparator end @@ -247,7 +242,6 @@ object MainForm: TMainForm Left = 471 Top = 0 Width = 8 - Caption = 'ToolButton6' ImageIndex = 42 Style = tbsSeparator end @@ -292,14 +286,12 @@ object MainForm: TMainForm Style = tbsCheck OnClick = tbRotateClick end - object ToolButton2: TToolButton + object tbTraceSeparator: TToolButton Left = 571 Top = 0 Width = 8 - Caption = 'ToolButton2' ImageIndex = 39 Style = tbsSeparator - Visible = False end object tbShowTrace: TToolButton Left = 579 @@ -307,7 +299,6 @@ object MainForm: TMainForm Hint = 'Show trace window' Caption = 'tbShowTrace' ImageIndex = 38 - Visible = False OnClick = tbShowTraceClick end end @@ -315,7 +306,7 @@ object MainForm: TMainForm Left = 0 Top = 28 Width = 160 - Height = 435 + Height = 430 Align = alLeft Columns = < item @@ -336,7 +327,7 @@ object MainForm: TMainForm Left = 164 Top = 28 Width = 557 - Height = 435 + Height = 430 Align = alClient BevelInner = bvLowered BevelOuter = bvNone @@ -347,7 +338,7 @@ object MainForm: TMainForm Left = 1 Top = 1 Width = 555 - Height = 433 + Height = 428 Align = alClient Anchors = [] Center = True @@ -361,7 +352,7 @@ object MainForm: TMainForm end object StatusBar: TStatusBar Left = 0 - Top = 463 + Top = 458 Width = 721 Height = 19 Panels = < @@ -2918,6 +2909,14 @@ object MainForm: TMainForm Caption = '-' GroupIndex = 2 end + object mnuBuiltinVars: TMenuItem + Caption = 'Built-in' + GroupIndex = 2 + end + object mnuPluginVars: TMenuItem + Caption = 'Plugins' + GroupIndex = 2 + end end object mnuScript: TMenuItem Caption = 'Script' diff --git a/2.10/Source/Main.pas b/2.10/Source/Main.pas index bc89ce1..3abb15a 100644 --- a/2.10/Source/Main.pas +++ b/2.10/Source/Main.pas @@ -184,6 +184,8 @@ type tbShowTrace: TToolButton; tbTraceSeparator: TToolButton; mnuRenderAll: TMenuItem; + mnuBuiltinVars: TMenuItem; + mnuPluginVars: TMenuItem; procedure tbzoomoutwindowClick(Sender: TObject); procedure mnuimageClick(Sender: TObject); procedure mnuExitClick(Sender: TObject); @@ -1371,6 +1373,9 @@ begin if cp1.vibrancy <> 1 then parameters := parameters + format('vibrancy="%g" ', [cp1.vibrancy]); + if cp1.gamma_threshold <> 0 then + parameters := parameters + format('gamma_threshold="%g" ', [cp1.gamma_threshold]); + if cp1.soloXform >= 0 then parameters := parameters + format('soloxform="%d" ', [cp1.soloXform]); @@ -1378,8 +1383,7 @@ begin format('estimator_radius="%g" ', [cp1.estimator]) + format('estimator_minimum="%g" ', [cp1.estimator_min]) + format('estimator_curve="%g" ', [cp1.estimator_curve]) + - format('temporal_samples="%d" ', [cp1.jitters]) + - format('gamma_threshold="%g" ', [cp1.gamma_treshold]); + format('temporal_samples="%d" ', [cp1.jitters]); FileList.Add(''); { Write transform parameters } @@ -1427,7 +1431,7 @@ begin FileList := TStringList.Create; try FileList.LoadFromFile(filename); - if pos(title, FileList.Text) <> 0 then Result := true; + if pos(' 0 then Result := true; finally FileList.Free; end @@ -1482,10 +1486,10 @@ begin try FileList.LoadFromFile(bakname); - if Pos(title, FileList.Text) <> 0 then + if Pos(' 0 then begin i := 0; - while Pos('name="' + title + '"', Trim(FileList[i])) = 0 do + while Pos(' '' then Parsecp.hue_rotation := StrToFloat(v); v := Attributes.Value('brightness'); @@ -4112,9 +4121,11 @@ begin v := Attributes.Value('gamma'); if v <> '' then Parsecp.gamma := StrToFloat(v); v := Attributes.Value('vibrancy'); - if v <> '' then Parsecp.vibrancy := StrToFloat(v); if (LimitVibrancy) and (Parsecp.vibrancy > 1) then Parsecp.vibrancy := 1; + v := Attributes.Value('gamma_threshold'); + if v <> '' then Parsecp.gamma_threshold := StrToFloat(v) + else Parsecp.gamma_threshold := 0; v := Attributes.Value('zoom'); if v <> '' then Parsecp.zoom := StrToFloat(v); @@ -4841,7 +4852,10 @@ begin NewMenuItem.GroupIndex := 2; NewMenuItem.RadioItem := True; VarMenus[i] := NewMenuItem; - mnuvar.Add(NewMenuItem); + if i < NumBuiltinVars then + mnuBuiltinVars.Add(NewMenuItem) + else + mnuPluginVars.Add(NewMenuItem); end; end; diff --git a/2.10/Source/Options.dfm b/2.10/Source/Options.dfm index 1456f50..deadda1 100644 --- a/2.10/Source/Options.dfm +++ b/2.10/Source/Options.dfm @@ -51,8 +51,8 @@ object OptionsForm: TOptionsForm HelpContext = 1 Caption = 'General' object chkConfirmDel: TCheckBox - Left = 8 - Top = 183 + Left = 144 + Top = 127 Width = 97 Height = 17 HelpContext = 1005 @@ -61,7 +61,7 @@ object OptionsForm: TOptionsForm end object JPEG: TGroupBox Left = 8 - Top = 124 + Top = 118 Width = 121 Height = 55 Caption = 'JPEG Quality' @@ -219,13 +219,51 @@ object OptionsForm: TOptionsForm TabOrder = 2 end end - object GroupBox18: TGroupBox + object chkOldPaletteFormat: TCheckBox + Left = 144 + Top = 148 + Width = 121 + Height = 29 + Caption = 'Save gradient in old file format' + TabOrder = 4 + WordWrap = True + end + object chkConfirmExit: TCheckBox + Left = 144 + Top = 183 + Width = 81 + Height = 17 + HelpContext = 1005 + Caption = 'Confirm exit' + TabOrder = 5 + end + object chkConfirmStopRender: TCheckBox + Left = 144 + Top = 210 + Width = 121 + Height = 17 + Caption = 'Confirm stop render' + TabOrder = 6 + end + object rgTransparency: TRadioGroup Left = 8 - Top = 64 + Top = 176 Width = 121 Height = 57 + Caption = 'PNG Transparency' + ItemIndex = 0 + Items.Strings = ( + 'Disabled' + 'Enabled') + TabOrder = 7 + end + object GroupBox18: TGroupBox + Left = 8 + Top = 61 + Width = 121 + Height = 55 Caption = 'Internal buffer depth' - TabOrder = 4 + TabOrder = 8 object cbInternalBitsPerSample: TComboBox Left = 16 Top = 20 @@ -241,32 +279,6 @@ object OptionsForm: TOptionsForm '64-bit integer') end end - object chkOldPaletteFormat: TCheckBox - Left = 8 - Top = 204 - Width = 121 - Height = 29 - Caption = 'Save gradient in old file format' - TabOrder = 5 - WordWrap = True - end - object chkConfirmExit: TCheckBox - Left = 136 - Top = 183 - Width = 81 - Height = 17 - HelpContext = 1005 - Caption = 'Confirm exit' - TabOrder = 6 - end - object chkConfirmStopRender: TCheckBox - Left = 136 - Top = 210 - Width = 121 - Height = 17 - Caption = 'Confirm stop render' - TabOrder = 7 - end end object EditorPage: TTabSheet Caption = 'Editor' @@ -432,17 +444,6 @@ object OptionsForm: TOptionsForm TabOrder = 1 end end - object rgDoubleClickVars: TRadioGroup - Left = 160 - Top = 144 - Width = 273 - Height = 57 - Caption = 'Double-click on variation' - Items.Strings = ( - 'Reset value to zero' - 'Reset value to zero, if zero set to "1"') - TabOrder = 3 - end end object DisplayPage: TTabSheet Caption = 'Display' @@ -507,105 +508,116 @@ object OptionsForm: TOptionsForm Caption = 'Rendering' TabOrder = 0 object lblSampleDensity: TLabel - Left = 40 + Left = 56 Top = 19 - Width = 38 + Width = 41 Height = 13 + Alignment = taRightJustify Caption = 'Quality:' end object lblGamma: TLabel - Left = 40 + Left = 56 Top = 43 - Width = 39 + Width = 41 Height = 13 + Alignment = taRightJustify Caption = 'Gamma:' end object lblBrightness: TLabel - Left = 24 + Left = 40 Top = 67 - Width = 54 + Width = 57 Height = 13 + Alignment = taRightJustify Caption = 'Brightness:' end object lblVibrancy: TLabel - Left = 32 + Left = 48 Top = 91 - Width = 45 + Width = 49 Height = 13 + Alignment = taRightJustify Caption = 'Vibrancy:' end object lblOversample: TLabel - Left = 16 - Top = 115 - Width = 61 + Left = 32 + Top = 139 + Width = 65 Height = 13 + Alignment = taRightJustify Caption = 'Oversample:' end object lblFilterRadius: TLabel - Left = 16 - Top = 139 - Width = 63 + Left = 32 + Top = 163 + Width = 65 Height = 13 + Alignment = taRightJustify Caption = 'Filter Radius:' end + object lblGammaThreshold: TLabel + Left = 8 + Top = 115 + Width = 89 + Height = 14 + Alignment = taRightJustify + Caption = 'Gamma threshold:' + WordWrap = True + end object txtSampleDensity: TEdit - Left = 88 + Left = 104 Top = 16 - Width = 65 + Width = 49 Height = 21 HelpContext = 1006 TabOrder = 0 end object txtGamma: TEdit - Left = 88 + Left = 104 Top = 40 - Width = 65 + Width = 49 Height = 21 HelpContext = 1007 TabOrder = 1 end object txtBrightness: TEdit - Left = 88 + Left = 104 Top = 64 - Width = 65 + Width = 49 Height = 21 HelpContext = 1008 TabOrder = 2 end object txtVibrancy: TEdit - Left = 88 + Left = 104 Top = 88 - Width = 65 + Width = 49 Height = 21 HelpContext = 1009 TabOrder = 3 end object txtOversample: TEdit - Left = 88 - Top = 112 - Width = 65 + Left = 104 + Top = 136 + Width = 49 Height = 21 HelpContext = 1010 TabOrder = 4 end object txtFilterRadius: TEdit - Left = 88 - Top = 136 - Width = 65 + Left = 104 + Top = 160 + Width = 49 Height = 21 HelpContext = 1011 TabOrder = 5 end - object rgTransparency: TRadioGroup - Left = 8 - Top = 160 - Width = 153 - Height = 61 - Caption = 'PNG Transparency' - ItemIndex = 0 - Items.Strings = ( - 'Disabled' - 'Enabled') + object txtGammaThreshold: TEdit + Left = 104 + Top = 112 + Width = 49 + Height = 21 + HelpContext = 1011 TabOrder = 6 end end diff --git a/2.10/Source/Options.pas b/2.10/Source/Options.pas index 0be7062..2205c0e 100644 --- a/2.10/Source/Options.pas +++ b/2.10/Source/Options.pas @@ -200,20 +200,16 @@ type chkPlaysound: TCheckBox; btnPlay: TSpeedButton; Label44: TLabel; - GroupBox18: TGroupBox; - cbInternalBitsPerSample: TComboBox; GroupBox20: TGroupBox; chkShowTransparency: TCheckBox; chkExtendMainPreview: TCheckBox; Label48: TLabel; - rgTransparency: TRadioGroup; cbExtendPercent: TComboBox; chkShowRenderStats: TCheckBox; rgRotationMode: TRadioGroup; GroupBox21: TGroupBox; chkAxisLock: TCheckBox; chkExtendedEdit: TCheckBox; - rgDoubleClickVars: TRadioGroup; chkOldPaletteFormat: TCheckBox; rgZoomingMode: TRadioGroup; chkShowAllXforms: TCheckBox; @@ -221,6 +217,11 @@ type btnGradientsFile: TSpeedButton; chkConfirmExit: TCheckBox; chkConfirmStopRender: TCheckBox; + rgTransparency: TRadioGroup; + GroupBox18: TGroupBox; + cbInternalBitsPerSample: TComboBox; + txtGammaThreshold: TEdit; + lblGammaThreshold: TLabel; procedure btnCancelClick(Sender: TObject); procedure FormShow(Sender: TObject); procedure btnOKClick(Sender: TObject); @@ -332,8 +333,6 @@ begin chkHelpers.Checked := HelpersEnabled; chkExtendedEdit.Checked := ExtEditEnabled; chkAxisLock.Checked := TransformAxisLock; - if DoubleClickSetVars then rgDoubleClickVars.ItemIndex := 1 - else rgDoubleClickVars.ItemIndex := 0; chkShowAllXforms.Checked := ShowAllXforms; { Display tab } @@ -343,6 +342,8 @@ begin txtVibrancy.Text := FloatToStr(defVibrancy); txtOversample.Text := IntToStr(defOversample); txtFilterRadius.Text := FloatToStr(defFilterRadius); + txtGammaThreshold.Text := FloatToStr(defGammaThreshold); + txtLowQuality.Text := FloatToStr(prevLowQuality); txtMediumQuality.Text := FloatToStr(prevMediumQuality); txtHighQuality.Text := FloatToStr(prevHighQuality); @@ -471,7 +472,6 @@ begin ExtEditEnabled := chkExtendedEdit.Checked; TransformAxisLock := chkAxisLock.Checked; - DoubleClickSetVars := rgDoubleClickVars.ItemIndex <> 0; { Display tab } defSampleDensity := StrToFloat(txtSampleDensity.Text); @@ -485,6 +485,8 @@ begin if defVibrancy < 0 then defVibrancy := 0.1; defFilterRadius := StrToFloat(txtFilterRadius.Text); if defFilterRadius <= 0 then defFilterRadius := 0.1; + defGammaThreshold := StrToFloat(txtGammaThreshold.Text); + if defGammaThreshold < 0 then defGammaThreshold := 0; defOversample := StrToInt(txtOversample.Text); if defOversample > 4 then defOversample := 4; if defOversample < 1 then defOversample := 1; @@ -492,10 +494,10 @@ begin if prevLowQuality > 100 then prevLowQuality := 100; if prevLowQuality < 0.01 then prevLowQuality := 0.01; prevMediumQuality := StrToFloat(txtMediumQuality.Text); - if prevMediumQuality > 100 then prevMediumQuality := 100; + if prevMediumQuality > 1000 then prevMediumQuality := 1000; if prevMediumQuality < 0.01 then prevMediumQuality := 0.01; prevHighQuality := StrToFloat(txtHighQuality.Text); - if prevHighQuality > 100 then prevHighQuality := 100; + if prevHighQuality > 10000 then prevHighQuality := 10000; if prevHighQuality < 0.01 then prevHighQuality := 0.01; MainPreviewScale := 1 + 0.02 * StrToFloatDef(cbExtendPercent.Text, 0); diff --git a/2.10/Source/Regstry.pas b/2.10/Source/Regstry.pas index da9e9a0..3f5f702 100644 --- a/2.10/Source/Regstry.pas +++ b/2.10/Source/Regstry.pas @@ -79,6 +79,7 @@ begin begin SavePath := DefaultPath + 'Parameters\My Flames.flame'; end; + if Registry.ValueExists('SmoothPaletteFile') then begin defSmoothPaletteFile := Registry.ReadString('SmoothPaletteFIle'); @@ -143,9 +144,11 @@ begin begin TryLength := 100000; end; + if Registry.ValueExists('MinTransforms') then begin randMinTransforms := Registry.ReadInteger('MinTransforms'); + if randMinTransforms <= 0 then randMinTransforms := 2; end else begin @@ -154,14 +157,17 @@ begin if Registry.ValueExists('MaxTransforms') then begin randMaxTransforms := Registry.ReadInteger('MaxTransforms'); + if randMaxTransforms < randMinTransforms then randMaxTransforms := randMinTransforms; end else begin - randMaxTransforms := 3; + randMaxTransforms := randMinTransforms + 1; end; + if Registry.ValueExists('MutationMinTransforms') then begin mutantMinTransforms := Registry.ReadInteger('MutationMinTransforms'); + if mutantMinTransforms <= 0 then mutantMinTransforms := 2; end else begin @@ -170,11 +176,13 @@ begin if Registry.ValueExists('MutationMaxTransforms') then begin mutantMaxTransforms := Registry.ReadInteger('MutationMaxTransforms'); + if mutantMaxTransforms < mutantMinTransforms then mutantMinTransforms := mutantMinTransforms; end else begin - mutantMaxTransforms := 6; + mutantMaxTransforms := mutantMinTransforms + 1; end; + if Registry.ValueExists('RandomGradient') then begin randGradient := Registry.ReadInteger('RandomGradient'); @@ -242,6 +250,7 @@ begin if Registry.ValueExists('MutatePreviewQaulity') then begin MutatePrevQual := Registry.ReadInteger('MutatePreviewQaulity'); + if MutatePrevQual <= 0 then MutatePrevQual := 1; end else begin @@ -250,6 +259,7 @@ begin if Registry.ValueExists('AdjustPreviewQaulity') then begin AdjustPrevQual := Registry.ReadInteger('AdjustPreviewQaulity'); + if AdjustPrevQual <= 0 then AdjustPrevQual := 1; end else begin @@ -321,6 +331,7 @@ begin if Registry.ValueExists('MinNodes') then begin MinNodes := Registry.ReadInteger('MinNodes'); + if MinNodes < 2 then MinNodes := 2; end else begin @@ -353,6 +364,7 @@ begin if Registry.ValueExists('MaxNodes') then begin MaxNodes := Registry.ReadInteger('MaxNodes'); + if MaxNodes < MinNodes then MaxNodes := MinNodes; end else begin @@ -361,6 +373,7 @@ begin if Registry.ValueExists('MaxHue') then begin MaxHue := Registry.ReadInteger('MaxHue'); + if MaxHue < 0 then MaxHue := 0; end else begin @@ -369,6 +382,7 @@ begin if Registry.ValueExists('MaxSat') then begin MaxSat := Registry.ReadInteger('MaxSat'); + if MaxSat < 0 then MaxSat := 0; end else begin @@ -382,9 +396,11 @@ begin begin randGradientFile := '' end; + if Registry.ValueExists('ReferenceMode') then ReferenceMode := Registry.ReadInteger('ReferenceMode') else ReferenceMode := 0; + if Registry.ValueExists('RotationMode') then MainForm_RotationMode := Registry.ReadInteger('RotationMode') else MainForm_RotationMode := 0; @@ -392,6 +408,7 @@ begin if Registry.ValueExists('MaxLum') then begin MaxLum := Registry.ReadInteger('MaxLum'); + if MaxLum < 0 then MaxLum := 0; end else begin @@ -400,6 +417,7 @@ begin if Registry.ValueExists('BatchSize') then begin BatchSize := Registry.ReadInteger('BatchSize'); + if BatchSize <= 0 then BatchSize := 10; end else begin @@ -432,6 +450,7 @@ begin if Registry.ValueExists('ExportWidth') then begin ExportWidth := Registry.ReadInteger('ExportWidth'); + if ExportWidth <= 0 then ExportWidth := 640; end else begin @@ -440,6 +459,7 @@ begin if Registry.ValueExists('ExportHeight') then begin ExportHeight := Registry.ReadInteger('ExportHeight'); + if ExportHeight <= 0 then ExportHeight := 480; end else begin @@ -448,6 +468,7 @@ begin if Registry.ValueExists('ExportDensity') then begin ExportDensity := Registry.ReadFloat('ExportDensity'); + if ExportDensity <= 0 then ExportDensity := 100; end else begin @@ -456,6 +477,7 @@ begin if Registry.ValueExists('ExportOversample') then begin ExportOversample := Registry.ReadInteger('ExportOversample'); + if ExportOversample <= 0 then ExportOversample := 2; end else begin @@ -464,6 +486,7 @@ begin if Registry.ValueExists('ExportFilter') then begin ExportFilter := Registry.ReadFloat('ExportFilter'); + if ExportFilter <= 0 then ExportFilter := 0.6; end else begin @@ -472,6 +495,7 @@ begin if Registry.ValueExists('ExportBatches') then begin ExportBatches := Registry.ReadInteger('ExportBatches'); + if ExportBatches <= 0 then ExportBatches := 3; end else begin @@ -571,11 +595,13 @@ begin if Registry.ValueExists('NrTreads') then begin NrTreads := Registry.ReadInteger('NrTreads'); + if NrTreads <= 0 then NrTreads := 1; end else begin NrTreads := 1; end; if Registry.ValueExists('UseNrThreads') then begin UseNrThreads := Registry.ReadInteger('UseNrThreads'); + if UseNrThreads <= 0 then UseNrThreads := 1; end else begin UseNrThreads := 1; end; @@ -720,9 +746,6 @@ begin if Registry.ValueExists('LockTransformAxis') then TransformAxisLock := Registry.ReadBool('LockTransformAxis') else TransformAxisLock := true; - if Registry.ValueExists('DoubleClickSetVars') then - DoubleClickSetVars := Registry.ReadBool('DoubleClickSetVars') - else DoubleClickSetVars := true; end else begin UseTransformColors := false; @@ -735,7 +758,6 @@ begin ReferenceTriangleColor := integer(clGray); ExtEditEnabled := true; TransformAxisLock := true; - DoubleClickSetVars := true; end; Registry.CloseKey; @@ -952,6 +974,14 @@ begin begin defFilterRadius := 0.2; end; + if Registry.ValueExists('GammaThreshold') then + begin + defGammaThreshold := Registry.ReadFloat('GammaThreshold'); + end + else + begin + defGammaThreshold := 0.01; + end; if Registry.ValueExists('Oversample') then begin defOversample := Registry.ReadInteger('Oversample'); @@ -1001,6 +1031,7 @@ begin defVibrancy := 1; defFilterRadius := 0.2; defOversample := 1; + defGammaThreshold := 0.01; defPreviewDensity := 0.5; prevLowQuality := 0.1; prevMediumQuality := 1; @@ -1132,7 +1163,6 @@ begin Registry.WriteInteger('ReferenceTriangleColor', ReferenceTriangleColor); Registry.WriteBool('ExtendedEdit', ExtEditEnabled); Registry.WriteBool('LockTransformAxis', TransformAxisLock); - Registry.WriteBool('DoubleClickSetVars', DoubleClickSetVars); end; Registry.CloseKey; @@ -1145,6 +1175,7 @@ begin Registry.WriteFloat('Vibrancy', defVibrancy); Registry.WriteFloat('FilterRadius', defFilterRadius); Registry.WriteInteger('Oversample', defOversample); + Registry.WriteFloat('GammaThreshold', defGammaThreshold); Registry.WriteFloat('PreviewDensity', defPreviewDensity); Registry.WriteFloat('PreviewLowQuality', prevLowQuality); Registry.WriteFloat('PreviewMediumQuality', prevMediumQuality); diff --git a/2.10/Source/Tracer.pas b/2.10/Source/Tracer.pas index bd4e871..4ae4e48 100644 --- a/2.10/Source/Tracer.pas +++ b/2.10/Source/Tracer.pas @@ -1,6 +1,7 @@ { Apophysis Copyright (C) 2001-2004 Mark Townsend Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov + Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,8 +17,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. } + unit Tracer; +//{$define TRACEFORM_HIDDEN} + interface uses @@ -70,8 +74,6 @@ procedure TTraceForm.FormCreate(Sender: TObject); var Registry: TRegistry; begin - TraceLevel := 0; // Tracer disabled in release version - { Read position from registry } Registry := TRegistry.Create; try @@ -87,8 +89,21 @@ begin if Registry.ValueExists('Height') then self.Height := Registry.ReadInteger('Height'); -// if Registry.ValueExists('TraceLevel') then -// TraceLevel := Registry.ReadInteger('TraceLevel'); +{$ifndef TRACEFORM_HIDDEN} + + if Registry.ValueExists('TraceLevel') then + TraceLevel := Registry.ReadInteger('TraceLevel') + else + TraceLevel := 0; + +{$else} // Tracer disabled in release version + + TraceLevel := 0; + MainForm.tbShowTrace.Visible := false; + MainForm.tbTraceSeparator.Visible := false; + +{$endif} + end; Registry.CloseKey; finally diff --git a/2.10/Source/XForm.pas b/2.10/Source/XForm.pas index eb316c7..8aee3dd 100644 --- a/2.10/Source/XForm.pas +++ b/2.10/Source/XForm.pas @@ -33,13 +33,11 @@ const type TCPpoint = record x, y, c: double; - //invisible: boolean; end; PCPpoint = ^TCPpoint; TXYpoint = record x, y: double; - //skip: boolean; end; PXYpoint = ^TXYpoint; @@ -66,7 +64,6 @@ type postXswap: boolean; noPlot: boolean; - //RetraceXform: boolean; // nx,ny,x,y: double; // script: TatPascalScripter; @@ -1909,9 +1906,6 @@ begin px := FPx; py := FPy; - -// if PlotMode <> keepPlot then -// skip := (PlotMode = neverPlot); end; /////////////////////////////////////////////////////////////////////////////// @@ -2147,7 +2141,6 @@ begin modWeights[i] := xform.modWeights[i]; noPlot := xform.noPlot; - //RetraceXform := xform.RetraceXform; end; /////////////////////////////////////////////////////////////////////////////// @@ -2192,10 +2185,7 @@ begin Result := Result + '" '; end; -// if RetraceXform then -// Result := Result + 'plotmode="retrace" ' -// else - if noPlot then + if noPlot = true then Result := Result + 'plotmode="off" '; Result := Result + '/>';