📄 previews.pas
字号:
ars[1] := true;
undos[1]:='HSL adjust';
end;
// rgb
if (PageControl1.ActivePage = TabSheet3) and not ars[2] then
begin
red := fIPDialogParams.RGB_R;
green := fIPDialogParams.RGB_G;
blue := fIPDialogParams.RGB_B;
trackbar6.Position := red;
trackbar7.Position := green;
trackbar8.Position := blue;
edit7.text := inttostr(red);
edit6.text := inttostr(green);
edit5.texT := inttostr(blue);
ars[2] := true;
undos[2]:='RGB adjust';
end;
// user filter
if (PageControl1.ActivePage = TabSheet4) and not ars[3] then
begin
Filter:=fIPDialogParams.USERFILTER_Values;
listbox1.itemindex := 0;
LoadFilt;
ars[3] := true;
undos[3]:='Convolution Filter';
end;
// HSV
if (PageControl1.ActivePage = TabSheet5) and not ars[4] then
begin
bHue := fIPDialogParams.HSV_H;
bSat := fIPDialogParams.HSV_S;
bVal := fIPDialogParams.HSV_V;
trackbar9.Position := bHue;
trackbar10.Position := bSat;
trackbar11.Position := bVal;
edit19.text := inttostr(bHue);
edit18.text := inttostr(bSat);
edit17.text := inttostr(bVal);
ars[4] := true;
undos[4]:='HSV adjust';
end;
// threshold (histogram)
if (PageControl1.ActivePage = TabSheet6) and not ars[5] then
begin
DownLimit:=fIPDialogParams.EQUALIZATION_ThresholdDown;
UpLimit:=fIPDialogParams.EQUALIZATION_ThresholdUp;
EDownLimit:=fIPDialogParams.EQUALIZATION_EqDown;
EUpLimit:=fIPDialogParams.EQUALIZATION_EqUp;
AutoEqualize := false;
CheckListBox1.Checked[0] := false;
CheckListBox1.Checked[1] := false;
CheckListBox1.Checked[2] := false;
CheckListBox1.Checked[3] := true;
HistogramBox1.HistogramKind := [hkGray];
with RulerBox1 do
begin
GripsPos[0] := DownLimit.r;
GripsColor[0] := clGray;
GripsKind[0] := gkArrow2;
GripsPos[1] := UpLimit.r;
GripsColor[1] := clGray;
GripsKind[1] := gkArrow2;
end;
with RulerBox2 do
begin
GripsPos[0] := EDownLimit.r;
GripsColor[0] := clGray;
GripsPos[1] := EUpLimit.r;
GripsColor[1] := clGray;
end;
speedbutton3.down := false;
ars[5] := true;
undos[5]:='Histogram adjust';
end;
// bump map
if (PageControl1.ActivePage = TabSheet7) and not ars[6] then
begin
if fIPDialogParams.BUMPMAP_Auto then
begin
BumpLeft := ImageEn1.IEBitmap.Width div 2;
BumpTop := ImageEn1.IEBitmap.Height div 2;
BumpWidth := imax(ImageEn1.IEBitmap.Width, ImageEn1.IEBitmap.Height) div 2;
BumpHeight := BumpWidth;
end
else
begin
BumpLeft := fIPDialogParams.BUMPMAP_Left;
BumpTop := fIPDialogParams.BUMPMAP_Top;
BumpWidth := fIPDialogParams.BUMPMAP_Width;
BumpHeight := fIPDialogParams.BUMPMAP_Height;
end;
BumpCol := fIPDialogParams.BUMPMAP_Col;
BumpSrc := fIPDialogParams.BUMPMAP_Src;
edit22.text := inttostr(BumpLeft);
edit23.text := inttostr(BumpTop);
edit24.text := inttostr(BumpWidth);
edit25.text := inttostr(BumpHeight);
edit26.text := inttostr(BumpSrc);
HsvBox2.SetRGB(BumpCol.R,BumpCol.G,BumpCol.B);
ars[6] := true;
undos[6]:='Bump Map';
end;
// Lens
if (PageControl1.ActivePage = TabSheet8) and not ars[7] then
begin
if fIPDialogParams.LENS_Auto then
begin
LensLeft := ImageEn1.IEBitmap.Width div 2;
LensTop := ImageEn1.IEBitmap.Height div 2;
LensWidth := imax(ImageEn1.IEBitmap.Width, ImageEn1.IEBitmap.Height) div 2;
LensHeight := LensWidth;
end
else
begin
LensLeft := fIPDialogParams.LENS_Left;
LensTop := fIPDialogParams.LENS_Top;
LensWidth := fIPDialogParams.LENS_Width;
LensHeight := fIPDialogParams.LENS_Height;
end;
LensRef := fIPDialogParams.LENS_Ref;
edit27.text := inttostr(LensLeft);
edit28.text := inttostr(LensTop);
edit29.text := inttostr(LensWidth);
edit30.text := inttostr(LensHeight);
edit31.text := inttostr(trunc(LensRef * 10 - 10));
ars[7] := true;
undos[7]:='Lens effect';
end;
// Wave
if (PageControl1.ActivePage = TabSheet9) and not ars[8] then
begin
WaveAmplitude := fIPDialogParams.WAVE_Amplitude;
WaveWaveLength := fIPDialogParams.WAVE_WaveLength;
WavePhase := fIPDialogParams.WAVE_Phase;
WaveReflect := fIPDialogParams.WAVE_Reflect;
edit32.text := inttostr(WaveAmplitude);
edit33.text := inttostr(WaveWaveLength);
edit34.text := inttostr(WavePhase);
checkbox2.checked := WaveReflect;
ars[8] := true;
undos[8]:='Wave effect';
end;
// Morph filters
if (PageControl1.ActivePage = TabSheet10) and not ars[9] then
begin
MorphFilter := fIPDialogParams.MORPH_Filter;
MorphWinSize := fIPDialogParams.MORPH_WinSize;
ListBox2.ItemIndex := MorphFilter;
Edit35.Text := IntToStr(MorphWinSize);
ars[9] := true;
undos[9]:='Morph';
end;
// Rotate
if (PageControl1.ActivePage = TabSheet11) and not ars[10] then
begin
RotationAngle := fIPDialogParams.ROTATE_Angle;
EditRotate.Text := floattostr(RotationAngle);
TrackBarRotate.Position := trunc(RotationAngle*100);
CheckBox3.Checked := false;
CheckBox4.Checked := false;
NeedToFlip := false;
ars[10] := true;
undos[10]:='Rotate';
end;
// initialize FFT
if (PageControl1.ActivePage = TabSheet12) and not ars[11] then
begin
CheckBox1.Checked := fIPDialogParams.FFT_GrayScale;
if fIPDialogParams.FFT_Left>-1 then
ImageEnView1.Select( fIPDialogParams.FFT_Left, fIPDialogParams.FFT_Top, fIPDialogParams.FFT_Right, fIPDialogParams.FFT_Bottom, iespReplace );
ars[11] := true;
undos[11]:='FFT';
end;
// initialize Gamma Correction
if (PageControl1.ActivePage = tabGamma) and not ars[12] then
begin
trkGamma.Position := trunc(fIPDialogParams.GAMMACORRECTION_Value*10);
trkGammaChange(nil);
// Check all the gamma boxes
for I := 0 to cbxGamma.items.count - 1 do
cbxGamma.checked[i] := true;
ars[12] := true;
undos[12]:='Gamma Correction';
end;
// initialize Sharpen
if (PageControl1.ActivePage = TabSheet14) and not ars[13] then
begin
Sharpen := fIPDialogParams.SHARPEN_Sharpen;
SharpenSize := fIPDialogParams.SHARPEN_Size;
edit36.text := inttostr(Sharpen);
edit37.text := inttostr(SharpenSize);
trackbar4.position := Sharpen;
ars[13] := true;
undos[13]:='Sharpen';
end;
//
dochange := true;
end;
/////////////////////////////////////////////////////////////////////////////////////
procedure TfPreviews.FormActivate(Sender: TObject);
var
i:integer;
begin
doProgress := false;
dochange := true;
ResetParameters(true);
chkLockPreview.checked := DefaultLockPreview;
button3.enabled := not chkLockPreview.checked;
button3.visible := not chkLockPreview.checked;
HistogramBox1.AttachedImageEnProc := ImageEn2.Proc;
PageControl1.Visible := false;
TabSheet1.TabVisible := (peAll in pe) or (peContrast in pe);
TabSheet1.tag := 1;
TabSheet2.TabVisible := (peAll in pe) or (peHSL in pe);
TabSheet2.tag := 2;
TabSheet3.TabVisible := (peAll in pe) or (peRGB in pe);
TabSheet3.tag := 3;
TabSheet4.TabVisible := (peAll in pe) or (peUserFilt in pe);
TabSheet4.tag := 4;
TabSheet5.TabVisible := (peAll in pe) or (peHSV in pe);
TabSheet5.tag := 5;
TabSheet6.TabVisible := (peAll in pe) or (peEqualize in pe);
TabSheet6.tag := 6;
TabSheet7.TabVisible := (peAll in pe) or (peBumpMap in pe);
TabSheet7.tag := 7;
TabSheet8.TabVisible := (peAll in pe) or (peLens in pe);
TabSheet8.tag := 8;
TabSheet9.TabVisible := (peAll in pe) or (peWave in pe);
TabSheet9.tag := 9;
TabSheet10.TabVisible := (peAll in pe) or (peMorph in pe);
TabSheet10.tag := 10;
TabSheet11.TabVisible := (peAll in pe) or (peRotate in pe);
TabSheet11.tag := 11;
TabSheet12.TabVisible := (peAll in pe) or (peFFT in pe);
TabSheet12.tag := 12;
TabGamma.TabVisible := (peAll in pe) or (peGamma in pe);
TabGamma.tag := 13;
TabSheet14.TabVisible := (peAll in pe) or (peSharpen in pe);
TabSheet14.tag := 14;
if InitialPage <> nil then
PageControl1.ActivePage := InitialPage
else
PageControl1.ActivePage := PageControl1.FindNextPage(nil, true, true);
PageControl1.Visible := true;
//
imageen1.SetChessboardStyle(12,bsSolid);
imageen2.SetChessboardStyle(12,bsSolid);
// fit
imageen1.Fit;
// load filters
ListBox1.Items.Clear;
for i:=0 to IEGetFiltersCount-1 do
ListBox1.Items.Add( IEGetFilterName(i) );
//
if assigned(application) then
application.processmessages;
PageControl1Change(self); // calls CopyOrg
end;
/////////////////////////////////////////////////////////////////////////////////////
// applica solo l'effetto corrente
procedure TfPreviews.ApplyAct(im: TImageEnView);
var
gamChannels: TIEChannels;
v1: TIEProgressEvent;
v2: TObject;
xProgress: TProgressRec;
xLeft, xTop, xWidth, xHeight, x1, x2, y1, y2: integer;
xz: double;
tmpft: TIEFtImage;
cx, cy: double;
begin
if doProgress then
xProgress := Progress
else
fillchar(xProgress, sizeof(xProgress), 0);
v1 := xProgress.fOnProgress;
v2 := xProgress.Sender;
if PageControl1.ActivePage = TabSheet1 then
begin
_ContrastRGB(im.IEBitmap, Contrast, mr, mg, mb, 0, 0, im.IEBitmap.Width, im.IEBitmap.Height, v1, v2);
_IntensityRGBall(im.IEBitmap, Brightness, Brightness, Brightness, 0, 0, im.IEBitmap.Width, im.IEBitmap.Height, v1, v2);
end;
if PageControl1.ActivePage = TabSheet2 then
begin
_HSLvar(im.IEBitmap, Hue, Sat, Lum, 0, 0, im.IEBitmap.Width, im.IEBitmap.Height, v1, v2);
end;
if PageControl1.ActivePage = TabSheet3 then
begin
_IntensityRGBall(im.IEBitmap, red, green, blue, 0, 0, im.IEBitmap.Width, im.IEBitmap.Height, v1, v2);
end;
if PageControl1.ActivePage = TabSheet4 then
begin
_ApplyFilter(im.IEBitmap, Filter, 0, 0, im.IEBitmap.Width, im.IEBitmap.Height, xProgress);
end;
if PageControl1.ActivePage = TabSheet5 then
begin
_HSVvar(im.IEBitmap, bHue, bSat, bVal, 0, 0, im.IEBitmap.Width, im.IEBitmap.Height, v1, v2);
end;
if PageControl1.ActivePage = TabSheet6 then
begin
_Threshold(im.IEBitmap, DownLimit, UpLimit, CreateRGB(0, 0, 0), CreateRGB(255, 255, 255), 0, 0, im.IEBitmap.Width, im.IEBitmap.Height, v1, v2);
_HistEqualize(im.IEBitmap, EDownLimit, EUpLimit, 0, 0, im.IEBitmap.Width, im.IEBitmap.Height, v1, v2);
if SpeedButton3.Down then
_HistAutoEqualize(im.IEBitmap, 0, 0, im.IEBitmap.Width, im.IEBitmap.Height, v1, v2);
end;
if PageControl1.ActivePage = TabSheet7 then
begin
if im <> ImageEn1 then
begin
xz := ImageEn1.Zoom / 100;
xLeft := trunc(BumpLeft * xz - ImageEn1.ViewX);
xTop := trunc(BumpTop * xz - ImageEn1.ViewY);
xWidth := trunc(BumpWidth * xz);
xHeight := trunc(BumpHeight * xz);
_BumpMapping(im.IEBitmap, xLeft, xTop, xWidth, xHeight, BumpSrc, BumpCol, 0, 0, im.IEBitmap.Width, im.IEBitmap.Height, xProgress);
end
else
_BumpMapping(im.IEBitmap, BumpLeft, BumpTop, BumpWidth, BumpHeight, BumpSrc, BumpCol, 0, 0, im.IEBitmap.Width, im.IEBitmap.Height, xProgress);
end;
if PageControl1.ActivePage = TabSheet8 then
begin
if im <> ImageEn1 then
begin
xz := ImageEn1.Zoom / 100;
xLeft := trunc(LensLeft * xz - ImageEn1.ViewX);
xTop := trunc(LensTop * xz - ImageEn1.ViewY);
xWidth := trunc(LensWidth * xz);
xHeight := trunc(LensHeight * xz);
_Lens(im.IEBitmap, xLeft, xTop, xWidth, xHeight, LensRef, xProgress);
end
else
_Lens(im.IEBitmap, LensLeft, LensTop, LensWidth, LensHeight, LensRef, xProgress);
end;
if PageControl1.ActivePage = TabSheet9 then
begin
if im <> ImageEn1 then
begin
xz := ImageEn1.Zoom / 100;
x1 := trunc(WaveAmplitude * xz);
x2 := trunc(WaveWaveLength * xz);
_Wave(im.IEBitmap, x1, x2, WavePhase, WaveReflect, xProgress);
end
else
_Wave(im.IEBitmap, WaveAmplitude, WaveWaveLength, WavePhase, WaveReflect, xProgress);
end;
if PageControl1.ActivePage = TabSheet10 then
begin
_MorphFilter(im.IEBitmap, MorphWinSize, MorphFilter, 0, 0, im.IEBitmap.Width, im.IEBitmap.Height, v1, v2);
end;
if PageControl1.ActivePage = TabSheet11 then
begin
if CheckBox3.Checked then
im.Proc.Flip(fdHorizontal);
if CheckBox4.Checked then
im.Proc.Flip(fdVertical);
if (RotationAngle <> 0) then
im.Proc.Rotate(RotationAngle, true, ierFast, -1);
NeedToFlip := false;
end;
if PageControl1.ActivePage = TabSheet12 then
begin
if im <> ImageEn2 then
begin
// final image (full size)
FFTProgressPos := 0;
cx := FTImage.ComplexWidth;
cy := FTImage.ComplexHeight;
if checkbox1.checked then
FTImage.BuildFT(im.IEBitmap, ieitGRAYSCALE)
else
FTImage.BuildFT(im.IEBitmap, ieitRGB);
cx := FTImage.ComplexWidth / cx;
cy := FTImage.ComplexHeight / cy;
with ImageEnView1 do
begin
if Selected then
begin
x1 := trunc(SelX1 * cx);
y1 := trunc(SelY1 * cy);
x2 := trunc(SelX2 * cx);
y2 := trunc(SelY2 * cy);
FTImage.ClearZone(x1, y1, x2, y2);
end;
end;
FFTProgressPos := 0;
im.Proc.FTConvertFrom(FTImage);
ProgressBar1.Position := 0;
end
else
begin
// preview
FFTProgressPos := 0;
tmpft := TIEFtImage.Create;
tmpft.assign(FTImage);
x1:=-1; y1:=-1; x2:=-1; y2:=-1;
with ImageEnView1 do
if Selected then
begin
x1:=SelX1;
y1:=SelY1;
x2:=SelX2;
y2:=SelY2;
FTImage.ClearZone(x1,y1,x2,y2);
end;
ImageEnProc2.FTDisplayFrom(FTImage);
ImageEnView1.Fit;
if x1>-1 then
ImageEnView1.Select(x1,y1,x2,y2,iespReplace); // because the selection was removed by FTDisplayFrom
FFTProgressPos := 0;
ImageEn2.Proc.FTConvertFrom(FTImage);
ProgressBar1.Position := 0;
FTImage.assign(tmpft);
FreeAndNil(tmpft);
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -