Skip to content

Commit

Permalink
Keep manual histogram adjustement when loading a new image
Browse files Browse the repository at this point in the history
  • Loading branch information
pchev committed May 30, 2020
1 parent 6248931 commit b31bf33
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/fu_visu.pas
Expand Up @@ -88,7 +88,7 @@ Tf_visu = class(TFrame)
FimgMin, FimgMax: double;
FBullsEye, LockSpinEdit, FClipping, FInvert, FFlipVert, FFlipHorz: Boolean;
FZoom: double;
StartUpd,Updmax: boolean;
StartUpd,Updmax,HistogramAdjusted: boolean;
XP: integer;
FRedraw: TNotifyEvent;
FonZoom: TNotifyEvent;
Expand Down Expand Up @@ -151,6 +151,9 @@ constructor Tf_visu.Create(aOwner: TComponent);
Finitialized:=false;
ImgMax:=high(word);
ImgMin:=0;
HistogramAdjusted:=false;
StartUpd:=false;
Updmax:=false;
FBullsEye:=false;
FClipping:=false;
FInvert:=false;
Expand Down Expand Up @@ -205,7 +208,7 @@ procedure Tf_visu.SetLimit(SetLevel:boolean);
if (hh=0) and (sum>=shh) then hh:=i;
end;
end;
if SetLevel then begin
if SetLevel and (not HistogramAdjusted) then begin
if hval=1 then begin
FImgMin:=0;
FImgMax:=high(word);
Expand Down Expand Up @@ -353,6 +356,7 @@ procedure Tf_visu.FrameResize(Sender: TObject);

procedure Tf_visu.HistBarChange(Sender: TObject);
begin
HistogramAdjusted:=false;
SetLimit(true);
TimerRedraw.Enabled:=false;
TimerRedraw.Enabled:=true;
Expand Down Expand Up @@ -497,20 +501,23 @@ procedure Tf_visu.HistogramMouseUp(Sender: TObject; Button: TMouseButton;
ImgMin:=min(ImgMin,ImgMax);
end;
StartUpd:=false;
HistogramAdjusted:=true;
TimerRedraw.Enabled:=true;
end;

procedure Tf_visu.SpinEditMaxChange(Sender: TObject);
begin
if LockSpinEdit then exit;
SpinEditMin.maxValue:=min(FimageMax,SpinEditMax.Value);
HistogramAdjusted:=true;
TimerMinMax.Enabled:=true;
end;

procedure Tf_visu.SpinEditMinChange(Sender: TObject);
begin
if LockSpinEdit then exit;
SpinEditMax.minValue:=max(FimageMin,SpinEditMin.Value);
HistogramAdjusted:=true;
TimerMinMax.Enabled:=true;
end;

Expand Down

0 comments on commit b31bf33

Please sign in to comment.