new flame property - gamma threshold relative

This commit is contained in:
zueuk 2008-09-29 09:42:48 +00:00
parent bebba6acc3
commit a98cf43f5c
3 changed files with 61 additions and 10 deletions

View File

@ -98,7 +98,7 @@ type
cmap: TColorMap; cmap: TColorMap;
cmapindex: integer; cmapindex: integer;
time: double; time: double;
brightness: double; // 1.0 = normal Fbrightness: double; // 1.0 = normal
contrast: double; // 1.0 = normal contrast: double; // 1.0 = normal
gamma: double; gamma: double;
Width: integer; Width: integer;
@ -139,6 +139,11 @@ type
function getppux: double; function getppux: double;
function getppuy: double; function getppuy: double;
function GetBrightness: double;
procedure SetBrightness(br: double);
function GetRelativeGammaThreshold: double;
procedure SetRelativeGammaThreshold(gtr: double);
public public
procedure SaveToStringlist(sl: TStringlist); procedure SaveToStringlist(sl: TStringlist);
procedure SaveToFile(Filename: string); procedure SaveToFile(Filename: string);
@ -193,6 +198,13 @@ type
property ppux: double read getppux; property ppux: double read getppux;
property ppuy: double read getppuy; property ppuy: double read getppuy;
property brightness: double
read GetBrightness
write SetBrightness;
property gammaThreshRelative: double
read GetRelativeGammaThreshold
write SetRelativeGammaThreshold;
end; end;
function add_symmetry_to_control_point(var cp: TControlPoint; sym: integer): integer; function add_symmetry_to_control_point(var cp: TControlPoint; sym: integer): integer;
@ -257,7 +269,7 @@ begin
gamma := 1; gamma := 1;
vibrancy := 1; vibrancy := 1;
contrast := 1; contrast := 1;
brightness := 1; Fbrightness := 1;
sample_density := 50; sample_density := 50;
zoom := 0; zoom := 0;
@ -269,7 +281,7 @@ begin
estimator_min := 0.0; estimator_min := 0.0;
estimator_curve := 0.4; estimator_curve := 0.4;
jitters := 1; jitters := 1;
gamma_threshold := defGammaThreshold; gamma_threshold := 0.01;
FTwoColorDimensions := False; FTwoColorDimensions := False;
@ -684,6 +696,9 @@ begin
end else if AnsiCompareText(CurrentToken, 'vibrancy') = 0 then begin end else if AnsiCompareText(CurrentToken, 'vibrancy') = 0 then begin
Inc(ParsePos); Inc(ParsePos);
vibrancy := StrToFloat(ParseValues[ParsePos]); vibrancy := StrToFloat(ParseValues[ParsePos]);
end else if AnsiCompareText(CurrentToken, 'gamma_threshold') = 0 then begin
Inc(ParsePos);
gamma_threshold := StrToFloat(ParseValues[ParsePos]);
end else if AnsiCompareText(CurrentToken, 'hue_rotation') = 0 then begin end else if AnsiCompareText(CurrentToken, 'hue_rotation') = 0 then begin
Inc(ParsePos); Inc(ParsePos);
hue_rotation := StrToFloat(ParseValues[ParsePos]); hue_rotation := StrToFloat(ParseValues[ParsePos]);
@ -1410,10 +1425,11 @@ begin
Result.cmapindex := -1; Result.cmapindex := -1;
Result.brightness := c0 * cp1.brightness + c1 * cp2.brightness; Result.Fbrightness := c0 * cp1.Fbrightness + c1 * cp2.Fbrightness;
Result.contrast := c0 * cp1.contrast + c1 * cp2.contrast; Result.contrast := c0 * cp1.contrast + c1 * cp2.contrast;
Result.gamma := c0 * cp1.gamma + c1 * cp2.gamma; Result.gamma := c0 * cp1.gamma + c1 * cp2.gamma;
Result.vibrancy := c0 * cp1.vibrancy + c1 * cp2.vibrancy; Result.vibrancy := c0 * cp1.vibrancy + c1 * cp2.vibrancy;
Result.gamma_threshold := c0 * cp1.gamma_threshold + c1 * cp2.gamma_threshold;
Result.width := cp1.width; Result.width := cp1.width;
Result.height := cp1.height; Result.height := cp1.height;
Result.spatial_oversample := Round(c0 * cp1.spatial_oversample + c1 * cp2.spatial_oversample); Result.spatial_oversample := Round(c0 * cp1.spatial_oversample + c1 * cp2.spatial_oversample);
@ -1555,8 +1571,8 @@ begin
// sl.add(format('nbatches %d white_level %d background %f %f %f', - changed to integers - mt // sl.add(format('nbatches %d white_level %d background %f %f %f', - changed to integers - mt
sl.add(format('nbatches %d white_level %d background %d %d %d', sl.add(format('nbatches %d white_level %d background %d %d %d',
[nbatches, white_level, background[0], background[1], background[2]])); [nbatches, white_level, background[0], background[1], background[2]]));
sl.add(format('brightness %f gamma %f vibrancy %f hue_rotation %f cmap_inter %d', sl.add(format('brightness %f gamma %f vibrancy %f gamma_threshold %f hue_rotation %f cmap_inter %d',
[brightness * BRIGHT_ADJUST, gamma, vibrancy, hue_rotation, cmap_inter])); [Fbrightness * BRIGHT_ADJUST, gamma, vibrancy, gamma_threshold, hue_rotation, cmap_inter]));
sl.add(format('finalxformenabled %d', [ifthen(finalxformenabled, 1, 0)])); sl.add(format('finalxformenabled %d', [ifthen(finalxformenabled, 1, 0)]));
sl.add(format('soloxform %d', [soloXform])); sl.add(format('soloxform %d', [soloXform]));
@ -1900,12 +1916,36 @@ begin
result := pixels_per_unit * power(2, zoom) result := pixels_per_unit * power(2, zoom)
end; end;
///////////////////////////////////////////////////////////////////////////////
function TControlPoint.getppuy: double; function TControlPoint.getppuy: double;
begin begin
result := pixels_per_unit * power(2, zoom) result := pixels_per_unit * power(2, zoom)
end; end;
///////////////////////////////////////////////////////////////////////////////
function TControlPoint.GetBrightness: double;
begin
Result := Fbrightness;
end;
procedure TControlPoint.SetBrightness(br: double);
begin
if br > 0 then begin
if Fbrightness <> 0 then gamma_threshold := (gamma_threshold / Fbrightness) * br;
Fbrightness := br;
end;
end;
///////////////////////////////////////////////////////////////////////////////
function TControlPoint.GetRelativeGammaThreshold: double;
begin
Result := gamma_threshold / Fbrightness;
end;
procedure TControlPoint.SetRelativeGammaThreshold(gtr: double);
begin
gamma_threshold := gtr * Fbrightness;
end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
var var
vdfilled: boolean = False; vdfilled: boolean = False;
@ -1968,6 +2008,7 @@ var
begin begin
top := 0; bottom := 0; right := 0; left := 0; top := 0; bottom := 0; right := 0; left := 0;
Result := NumXForms; Result := NumXForms;
{
if ReferenceMode > 0 then if ReferenceMode > 0 then
begin begin
for i := 0 to Result-1 do for i := 0 to Result-1 do
@ -2016,6 +2057,7 @@ begin
end; end;
end end
else else
}
begin begin
Triangles[-1].x[0] := 1; Triangles[-1].y[0] := 0; // "x" Triangles[-1].x[0] := 1; Triangles[-1].y[0] := 0; // "x"
Triangles[-1].x[1] := 0; Triangles[-1].y[1] := 0; // "0" Triangles[-1].x[1] := 0; Triangles[-1].y[1] := 0; // "0"

View File

@ -42,7 +42,7 @@ const
RS_XO = 2; RS_XO = 2;
RS_VO = 3; RS_VO = 3;
AppVersionString = 'Apophysis 2.08 beta 2 pre2'; AppVersionString = 'Apophysis 2.08 beta 2 pre5+';
type type
TMouseMoveState = (msUsual, msZoomWindow, msZoomOutWindow, msZoomWindowMove, TMouseMoveState = (msUsual, msZoomWindow, msZoomOutWindow, msZoomWindowMove,
@ -2578,7 +2578,7 @@ begin
maincp.sample_density := defSampleDensity; maincp.sample_density := defSampleDensity;
maincp.spatial_oversample := defOversample; maincp.spatial_oversample := defOversample;
maincp.spatial_filter_radius := defFilterRadius; maincp.spatial_filter_radius := defFilterRadius;
maincp.gamma_threshold := defGammaThreshold; maincp.gammaThreshRelative := defGammaThreshold;
inc(MainSeed); inc(MainSeed);
RandSeed := MainSeed; RandSeed := MainSeed;

View File

@ -214,6 +214,8 @@ end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
procedure TfrmPostProcess.btnApplyClick(Sender: TObject); procedure TfrmPostProcess.btnApplyClick(Sender: TObject);
var
temp: double;
begin begin
TryStrToFloat(txtFilterRadius.Text, FCP.spatial_filter_radius); TryStrToFloat(txtFilterRadius.Text, FCP.spatial_filter_radius);
if FCP.spatial_filter_radius > 2 then begin if FCP.spatial_filter_radius > 2 then begin
@ -251,7 +253,8 @@ begin
txtContrast.Text := FloatTostr(0.01); txtContrast.Text := FloatTostr(0.01);
end; end;
TryStrToFloat(txtBrightness.Text, FCP.brightness); if TryStrToFloat(txtBrightness.Text, temp) then FCP.brightness := temp;
//TryStrToFloat(txtBrightness.Text, FCP.brightness);
if FCP.brightness > 100 then begin if FCP.brightness > 100 then begin
FCP.brightness := 100; FCP.brightness := 100;
txtBrightness.Text := '100'; txtBrightness.Text := '100';
@ -412,9 +415,15 @@ begin
end end
else if (Sender = pnlBrightness) then else if (Sender = pnlBrightness) then
begin begin
{
pValue := @fcp.brightness; pValue := @fcp.brightness;
pDefaultValue := @Brightness; pDefaultValue := @Brightness;
pEdit := @txtBrightness; pEdit := @txtBrightness;
}
if fcp.brightness = Brightness then exit;
fcp.brightness := Brightness;
txtBrightness.Text := FloatToStr(fcp.brightness);
end end
else if (Sender = pnlContrast) then else if (Sender = pnlContrast) then
begin begin