📄 iopreviews.pas
字号:
{$ENDIF}
{$IFDEF IEDELPHI10}
Panel3.ParentBackground := false;
Panel4.ParentBackground := false;
Panel1.ParentBackground := false;
Panel5.ParentBackground := false;
{$ENDIF}
{$IFDEF IEDELPHI11}
Panel3.ParentBackground := false;
Panel4.ParentBackground := false;
Panel1.ParentBackground := false;
Panel5.ParentBackground := false;
{$ENDIF}
Button4.Enabled := False;
end;
/////////////////////////////////////////////////////////////////////////////////////
procedure TfIOPreviews.ResetParameters;
begin
// JPEG PARAMETERS
JPEG_Quality := fParams.JPEG_Quality;
JPEG_Photometric := ord(fParams.JPEG_ColorSpace);
case fParams.JPEG_DCTMethod of
ioJPEG_ISLOW: JPEG_DCTMethod := 0;
ioJPEG_IFAST: JPEG_DCTMethod := 1;
ioJPEG_FLOAT: JPEG_DCTMethod := 2;
end;
JPEG_OptimalHuffman := fParams.JPEG_OptimalHuffman;
JPEG_Smooth := fParams.JPEG_Smooth;
JPEG_Progressive := fParams.JPEG_Progressive;
// JPEG2000 PARAMETERS
{$IFDEF IEINCLUDEJPEG2000}
J2000_Rate := fParams.J2000_Rate;
J2000_ColorSpace := integer(fParams.J2000_ColorSpace);
{$ENDIF}
// TIFF PARAMETERS
TIFF_LZWDecompFunc := fParams.TIFF_LZWDecompFunc;
TIFF_LZWCompFunc := fParams.TIFF_LZWCompFunc;
TIFF_Compression := fParams.TIFF_Compression;
TIFF_ImageIndex := fParams.TIFF_ImageIndex;
TIFF_PhotometInterpret := fParams.TIFF_PhotometInterpret;
TIFF_XPos := fParams.TIFF_XPos;
TIFF_YPos := fParams.TIFF_YPos;
TIFF_DocumentName := fParams.TIFF_DocumentName;
TIFF_ImageDescription := fParams.TIFF_ImageDescription;
TIFF_PageName := fParams.TIFF_PageName;
TIFF_PageNumber := fParams.TIFF_PageNumber;
TIFF_PageCount := fParams.TIFF_PageCount;
TIFF_SamplesPerPixel := fParams.SamplesPerPixel;
TIFF_BitsPerSample := fParams.BitsPerSample;
// GIF PARAMETERS
GIF_LZWDecompFunc := fParams.GIF_LZWDecompFunc;
GIF_LZWCompFunc := fParams.GIF_LZWCompFunc;
GIF_ImageIndex := fParams.GIF_ImageIndex;
GIF_XPos := fParams.GIF_XPos;
GIF_YPos := fParams.GIF_YPos;
GIF_DelayTime := fParams.GIF_DelayTime;
GIF_FlagTranspColor := fParams.GIF_FlagTranspColor;
GIF_TranspColor := fParams.GIF_TranspColor;
GIF_Interlaced := fParams.GIF_Interlaced;
GIF_Background := fParams.GIF_Background;
GIF_BitsPerSample := fParams.BitsPerSample;
// BMP PARAMETERS
BMP_Compression := fParams.BMP_Compression;
if fParams.SamplesPerPixel = 1 then
begin
case fParams.BitsPerSample of
1: BMP_BitsPerPixel := 0;
4: BMP_BitsPerPixel := 1;
8: BMP_BitsPerPixel := 2;
end;
end
else if fParams.SamplesPerPixel = 3 then
begin
case fParams.BitsPerSample of
5: BMP_BitsPerPixel := 3;
8: BMP_BitsPerPixel := 3;
end;
end;
// PCX PARAMETERS
PCX_Compression := fParams.PCX_Compression;
if fParams.SamplesPerPixel = 1 then
begin
case fParams.BitsPerSample of
1: PCX_BitsPerPixel := 0;
4: PCX_BitsPerPixel := 1;
8: PCX_BitsPerPixel := 2;
end;
end
else if fParams.SamplesPerPixel = 3 then
PCX_BitsPerPixel := 3;
// PNG PARAMETERS
if fParams.SamplesPerPixel = 1 then
begin
if fParams.BitsPerSample = 1 then
PNG_Colors := 0 // BW
else
PNG_Colors := 1; // 256 (palette)
end
else
PNG_Colors := 2; // True color
PNG_Interlaced := fParams.PNG_Interlaced;
PNG_Background := fParams.PNG_Background;
PNG_Filter := ord(fParams.PNG_Filter) - ord(ioPNG_FILTER_NONE);
PNG_Compression := fParams.PNG_Compression;
// TGA Parameters
if fParams.SamplesPerPixel = 1 then
begin
if fparams.BitsPerSample = 1 then
TGA_Colors := 0
else
TGA_Colors := 1;
end
else
TGA_Colors := 2;
TGA_Background := fParams.TGA_Background;
TGA_Compressed := fParams.TGA_Compressed;
TGA_Name := fParams.TGA_ImageName;
TGA_Description := fParams.TGA_Descriptor;
end;
/////////////////////////////////////////////////////////////////////////////////////
procedure TfIOPreviews.ApplyParameters;
var
idim:integer;
//lw:integer;
(*
idim: integer;
xbitcount: integer;
*)
begin
dochange := false;
idim:=imageen1.IEBitmap.RowLen * imageen1.IEBitmap.Height;
(*
// pf1bit and pf24bit only are supported now
case imageen1.bitmap.PixelFormat of
pf1bit: xbitcount := 1;
//pf8bit: xbitcount:=8;
//pf16bit: xbitcount:=16;
//pf32bit: xbitcount:=32;
else
xbitcount := 24;
end;
lw := (((imageen1.bitmap.Width * xBitCount) + 31) div 32) * 4;
idim := lw * imageen1.bitmap.height;
*)
if (PageControl1.ActivePage = TabSheetJPEG1) then
begin
// JPEG
edit22.text := inttostr(JPEG_Quality);
trackbar13.position := JPEG_Quality;
combobox13.itemindex := JPEG_Photometric;
combobox1.itemindex := JPEG_DCTMethod;
checkbox2.checked := JPEG_OptimalHuffman;
label4.caption := inttostr(idim) + ' bytes';
checkbox3.Checked := JPEG_Progressive;
edit23.text := inttostr(JPEG_Smooth);
end;
if (PageControl1.ActivePage = TabSheetJPEG2) then
begin
// JPEG simplified
edit16.text := inttostr(JPEG_Quality);
trackbar2.position := JPEG_Quality;
Label74.caption := inttostr(idim) + ' bytes';
end;
if (PageControl1.ActivePage = TabSheetJ20001) then
begin
// JPEG2000
{$IFDEF IEINCLUDEJPEG2000}
edit15.text := inttostr(round(J2000_Rate * 1000));
TrackBar1.position := round(J2000_Rate * 1000);
ComboBox15.itemindex := J2000_ColorSpace;
label68.caption := inttostr(idim) + ' bytes';
{$ENDIF}
end;
if (PageControl1.ActivePage = TabSheetTIFF1) then
begin
// TIFF
if TIFF_SamplesPerPixel = 1 then
begin
case TIFF_BitsPerSample of
1: combobox4.itemindex := 0;
2: combobox4.itemindex := 1;
3: combobox4.itemindex := 1;
4: combobox4.itemindex := 1;
5: combobox4.itemindex := 2;
6: combobox4.itemindex := 2;
7: combobox4.itemindex := 2;
8: combobox4.itemindex := 2;
16: combobox4.itemindex := 3;
end;
end
else if TIFF_SamplesPerPixel = 3 then
begin
case TIFF_BitsPerSample of
8: combobox4.itemindex := 4;
end;
end;
combobox2.itemindex := CompToCombo(TIFF_Compression);
edit1.text := inttostr(TIFF_ImageIndex);
combobox3.itemindex := ord(TIFF_PhotometInterpret) - ord(ioTIFF_WHITEISZERO);
if (combobox3.itemindex >= 5) and (combobox3.itemindex <= 7) then
begin
// CMYK, YCbCr, CIELab
combobox4.itemindex := 4; // (sempre 16m colori)
end
else if (combobox3.itemindex >= 0) and (combobox3.itemindex <= 1) then
begin
// B/W or grayscale
if TIFF_BitsPerSample = 1 then
combobox4.itemindex := 0
else
combobox4.itemindex := 2;
end
else
begin
if combobox4.itemindex = 0 then
combobox4.itemindex := 4;
end;
edit4.text := TIFF_DocumentName;
edit5.text := TIFF_ImageDescription;
edit6.text := TIFF_PageName;
edit7.text := inttostr(TIFF_PageNumber);
edit8.text := inttostr(TIFF_PageCount);
edit2.text := inttostr(TIFF_XPos);
edit3.text := inttostr(TIFF_YPos);
label11.caption := inttostr(idim) + ' bytes';
end;
if (PageControl1.ActivePage = TabSheetTIFF2) then
begin
// TIFF-simplified
ComboBox16.itemindex := CompToCombo(TIFF_Compression);
case TIFF_Compression of
ioTIFF_CCITT1D:
begin
TIFF_BitsPerSample := 1;
TIFF_SamplesPerPixel := 1;
end;
ioTIFF_G3FAX1D:
begin
TIFF_BitsPerSample := 1;
TIFF_SamplesPerPixel := 1;
end;
ioTIFF_G3FAX2D:
begin
TIFF_BitsPerSample := 1;
TIFF_SamplesPerPixel := 1;
end;
ioTIFF_G4FAX:
begin
TIFF_BitsPerSample := 1;
TIFF_SamplesPerPixel := 1;
end;
ioTIFF_JPEG:
begin
TIFF_BitsPerSample := 8;
TIFF_SamplesPerPixel := 3;
end;
end;
if TIFF_SamplesPerPixel = 1 then
case TIFF_BitsPerSample of
1: combobox17.itemindex := 0;
2: combobox17.itemindex := 1;
3: combobox17.itemindex := 1;
4: combobox17.itemindex := 1;
5: combobox17.itemindex := 2;
6: combobox17.itemindex := 2;
7: combobox17.itemindex := 2;
8: combobox17.itemindex := 2;
end
else if TIFF_SamplesPerPixel = 3 then
case TIFF_BitsPerSample of
8: combobox17.itemindex := 3;
end;
Label78.caption := inttostr(idim) + ' bytes';
end;
if (PageControl1.ActivePage = TabSheetGIF1) then
begin
// GIF
combobox5.itemindex := GIF_BitsPerSample - 1;
edit9.text := inttostr(GIF_ImageIndex);
checkbox4.checked := GIF_FlagTranspColor;
label34.enabled := GIF_FlagTranspColor;
panel3.enabled := GIF_FlagTranspColor;
panel3.color := TRGB2TColor(GIF_TranspColor);
checkbox5.checked := GIF_Interlaced;
edit10.text := inttostr(GIF_XPos);
edit11.text := inttostr(GIF_YPos);
edit12.text := inttostr(GIF_DelayTime);
panel4.color := TRGB2TColor(GIF_Background);
label28.caption := inttostr(idim) + ' bytes';
end;
if (PageControl1.ActivePage = TabSheetGIF2) then
begin
// GIF-simplified
combobox18.itemindex := GIF_BitsPerSample - 1;
Label84.caption := inttostr(idim) + ' bytes';
end;
if (PageControl1.ActivePage = TabSheetBMP1) then
begin
// BMP
combobox6.itemindex := ord(BMP_Compression) - ord(ioBMP_UNCOMPRESSED);
combobox7.itemindex := BMP_BitsPerPixel;
label40.caption := inttostr(idim) + ' bytes';
end;
if (PageControl1.ActivePage = TabSheetPCX1) then
begin
// PCX
combobox8.itemindex := ord(PCX_Compression) - ord(ioPCX_UNCOMPRESSED);
combobox9.itemindex := PCX_BitsPerPixel;
label46.caption := inttostr(idim) + ' bytes';
end;
if (PageControl1.ActivePage = TabSheetPNG1) then
begin
// PNG
ComboBox10.itemindex := PNG_Colors;
checkbox6.checked := PNG_Interlaced;
panel1.color := TRGB2TColor(PNG_Background);
combobox11.ItemIndex := PNG_Filter;
combobox12.itemindex := PNG_Compression;
label51.caption := inttostr(idim) + ' bytes';
end;
if (PageControl1.ActivePage = TabSheetTGA1) then
begin
// TGA
ComboBox14.itemindex := TGA_Colors;
Panel5.color := TRGB2TColor(TGA_Background);
CheckBox1.Checked := TGA_Compressed;
Edit13.text := TGA_Name;
Edit14.text := TGA_Description;
label59.caption := inttostr(idim) + ' bytes';
end;
//
dochange := true;
end;
/////////////////////////////////////////////////////////////////////////////////////
procedure TfIOPreviews.FormActivate(Sender: TObject);
var
i: integer;
fi: PIEFileFormatInfo;
begin
dochange := true;
chkLockPreview.Checked := DefaultLockPreview;
button3.enabled := not chkLockPreview.Checked; // enable/diable preview button
//
PageControl1.Visible := false;
for i := 0 to PageControl1.PageCount - 1 do
PageControl1.Pages[i].TabVisible := false;
fi := IEFileFormatGetInfo(fParams.FileType);
if fSimplified then
begin
// Simplified tabs
TabSheetJPEG2.TabVisible := (ppAll in pp) or (ppJPEG in pp);
if assigned(fi) and (ppJPEG in fi^.DialogPage) and (TabSheetJPEG2.TabVisible) then
PageControl1.ActivePage := TabSheetJPEG2;
TabSheetTIFF2.TabVisible := (ppAll in pp) or (ppTIFF in pp);
if assigned(fi) and (ppTIFF in fi^.DialogPage) and (TabSheetTIFF2.TabVisible) then
PageControl1.ActivePage := TabSheetTIFF2;
TabSheetGIF2.TabVisible := (ppAll in pp) or (ppGIF in pp);
if assigned(fi) and (ppGIF in fi^.DialogPage) and (TabSheetGIF2.TabVisible) then
PageControl1.ActivePage := TabSheetGIF2;
TabSheetBMP1.TabVisible := (ppAll in pp) or (ppBMP in pp);
if assigned(fi) and (ppBMP in fi^.DialogPage) and (TabSheetBMP1.TabVisible) then
PageControl1.ActivePage := TabSheetBMP1;
TabSheetPCX1.TabVisible := (ppAll in pp) or (ppPCX in pp);
if assigned(fi) and (ppPCX in fi^.DialogPage) and (TabSheetPCX1.TabVisible) then
PageControl1.ActivePage := TabSheetPCX1;
Label39.Top := 61;
Label40.Top := 77;
Label41.Top := 61;
Label42.top := 77;
Label45.Top := 61;
Label46.Top := 77;
Label47.Top := 61;
Label48.top := 77;
//chkLockPreview.Top := 302;
chkLockPreview.Top := trunc(302 / 96 * Screen.PixelsPerInch);
{$IFDEF IEINCLUDEPNG}
TabSheetPNG1.TabVisible := (ppAll in pp) or (ppPNG in pp);
if assigned(fi) and (ppPNG in fi^.DialogPage) and (TabSheetPNG1.TabVisible) then
PageControl1.ActivePage := TabSheetPNG1;
Label54.Visible := false;
Panel1.Visible := false;
GroupBox3.Visible := false;
Label50.Top := 61;
Label51.Top := 77;
Label52.Top := 61;
Label53.top := 77;
{$ENDIF}
TabSheetTGA1.TabVisible := (ppAll in pp) or (ppTGA in pp);
if assigned(fi) and (ppTGA in fi^.DialogPage) and (TabSheetTGA1.TabVisible) then
PageControl1.ActivePage := TabSheetTGA1;
Label63.Visible := false;
Panel5.Visible := false;
Label64.Visible := false;
Edit13.Visible := false;
Label65.Visible := false;
Edit14.Visible := false;
Label58.Top := 61;
Label59.Top := 77;
Label60.Top := 61;
Label61.top := 77;
{$IFDEF IEINCLUDEJPEG2000}
TabSheetJ20001.TabVisible := (ppAll in pp) or (ppJ2000 in pp);
if assigned(fi) and (ppJ2000 in fi^.DialogPage) and (TabSheetJ20001.TabVisible) then
PageControl1.ActivePage := TabSheetJ20001;
Label71.Visible := false;
ComboBox15.Visible := false;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -