📄 iopreviews.pas
字号:
imageen2.LockPaint;
imageen2.zoom := imageen1.zoom;
imageen2.setviewxy(imageen1.viewx, imageen1.viewy);
imageen2.UnLockPaint;
end;
/////////////////////////////////////////////////////////////////////////////////////
// change format type (pagecontrol1)
procedure TfIOPreviews.PageControl1Change(Sender: TObject);
begin
dochange := true;
ResetParameters;
ApplyParameters;
if chkLockPreview.Checked then
ApplyAct;
Button4.Enabled := False;
end;
/////////////////////////////////////////////////////////////////////////////////////
procedure TfIOPreviews.PageControl1Changing(Sender: TObject;
var AllowChange: Boolean);
begin
dochange := false;
end;
/////////////////////////////////////////////////////////////////////////////////////
// changes zoom/view of ImageEn1 (source image)
procedure TfIOPreviews.ImageEn1ViewChange(Sender: TObject; Change: Integer);
begin
imageen2.LockPaint;
imageen2.zoom := imageen1.zoom;
imageen2.setviewxy(imageen1.viewx, imageen1.viewy);
imageen2.UnLockPaint;
end;
/////////////////////////////////////////////////////////////////////////////////////
// change TIFF
(* combobox3
0: WHITEISZERO
1: BLACKISZERO
2: RGB
3: RGBPALETTE
4: TRANSPMASK
5: CMYK
6: YCBCR
7: CIELAB
*)
(* combobox4
0: B/W
1: 16
2: 256
3: 65536
4: 16M
*)
procedure TfIOPreviews.ComboBox2Click(Sender: TObject);
const
// samplesperpixel, bitspersample
cb2: array[0..4, 0..1] of integer = ((1, 1), // b/w
(1, 4), // 16 colors
(1, 8), // 256 colors
(1, 16), // 65536 colors
(3, 8)); // 16M
var
co: TIOTIFFCompression;
ph: TIOTIFFPhotometInterpret;
bx, sx: integer;
begin
if not dochange then
exit;
if sender = ComboBox3 then
begin
case ComboBox3.ItemIndex of
0, 1: if combobox4.itemindex > 0 then
combobox4.itemindex := 2;
2, 5, 6, 7: combobox4.itemindex := 4;
3: combobox4.itemindex := 2;
end;
end
else if sender = ComboBox4 then
begin
case ComboBox4.ItemIndex of
0: if combobox3.itemindex > 1 then
combobox3.itemindex := 1;
1: combobox3.itemindex := 3;
2: if (combobox3.itemindex = 2) or (combobox3.itemindex > 3) then
combobox3.itemindex := 3;
end;
end;
(*
if (combobox3.itemindex>=5) and (combobox3.itemindex<=7) then begin
// CMYK, YCbCr, CIELab
combobox4.itemindex:=4; // (sempre 16m colori)
combobox4.enabled:=false;
end else if (combobox3.itemindex>=0) and (combobox3.itemindex<=1) then begin
// B/W
combobox4.itemindex:=0; // (sempre B/W)
combobox4.enabled:=false;
end else begin
if combobox4.itemindex=0 then combobox4.itemindex:=4;
combobox4.enabled:=true;
end;
*)
co := ComboToComp(combobox2.itemindex);
ph := TIOTIFFPhotometInterpret(ord(ioTIFF_WHITEISZERO) + combobox3.itemindex);
if (ph = ioTIFF_CMYK) then
begin
// CMYK
bx := 8;
sx := 4;
end
else
begin
bx := cb2[combobox4.itemindex, 1]; // BitsPerSample
sx := cb2[combobox4.itemindex, 0]; // SamplesPerPixel
end;
if (co <> TIFF_Compression) or (ph <> TIFF_PhotometInterpret) or
(bx <> TIFF_BitsPerSample) or (sx <> TIFF_SamplesPerPixel) then
begin
TIFF_Compression := co;
TIFF_PhotometInterpret := ph;
TIFF_SamplesPerPixel := sx;
TIFF_BitsPerSample := bx;
if chkLockPreview.Checked then
begin
ApplyAct;
imageen2.paint;
end;
end;
TIFF_ImageIndex := strtointdef(edit1.text, 0);
TIFF_XPos := strtointdef(edit2.text, 0);
TIFF_YPos := strtointdef(edit3.text, 0);
TIFF_DocumentName := edit4.text;
TIFF_ImageDescription := edit5.text;
TIFF_PageName := edit6.text;
TIFF_PageNumber := strtointdef(edit7.text, 0);
TIFF_PageCount := strtointdef(edit8.text, 0);
Button4.Enabled := true;
end;
/////////////////////////////////////////////////////////////////////////////////////
// change GIF
procedure TfIOPreviews.ComboBox5Click(Sender: TObject);
var
co: integer;
it: boolean;
begin
if not dochange then
exit;
co := combobox5.itemindex + 1;
it := checkbox5.checked;
if (co <> GIF_BitsPerSample) or (it <> GIF_Interlaced) then
begin
GIF_BitsPerSample := co;
GIF_Interlaced := it;
if chkLockPreview.Checked then
begin
ApplyAct;
imageen2.paint;
end;
end;
GIF_ImageIndex := strtointdef(edit9.text, 0);
GIF_XPos := strtointdef(edit10.text, 0);
GIF_YPos := strtointdef(edit11.text, 0);
GIF_DelayTime := strtointdef(edit12.text, 0);
GIF_FlagTranspColor := checkbox4.checked;
label34.enabled := GIF_FlagTranspColor;
panel3.enabled := GIF_FlagTranspColor;
GIF_Interlaced := checkbox5.checked;
Button4.Enabled := true;
end;
/////////////////////////////////////////////////////////////////////////////////////
// change BMP
procedure TfIOPreviews.ComboBox6Change(Sender: TObject);
var
cl: integer;
cm: integer;
begin
if not dochange then
exit;
cl := combobox7.itemindex;
cm := combobox6.itemindex;
if (cl <> BMP_BitsPerPixel) or (cm <> ord(BMP_Compression)) then
begin
BMP_BitsPerPixel := cl;
if cm = 0 then
BMP_Compression := ioBMP_UNCOMPRESSED
else
BMP_Compression := ioBMP_RLE;
if chkLockPreview.Checked then
begin
ApplyAct;
imageen2.paint;
end;
end;
Button4.Enabled := true;
end;
/////////////////////////////////////////////////////////////////////////////////////
// change PCX
procedure TfIOPreviews.ComboBox8Change(Sender: TObject);
var
cl: integer;
cm: integer;
begin
if not dochange then
exit;
cl := combobox9.itemindex;
cm := combobox8.itemindex;
if (cl <> PCX_BitsPerPixel) or (cm <> ord(PCX_Compression)) then
begin
PCX_BitsPerPixel := cl;
if cm = 0 then
PCX_Compression := ioPCX_UNCOMPRESSED
else
PCX_Compression := ioPCX_RLE;
if chkLockPreview.Checked then
begin
ApplyAct;
imageen2.paint;
end;
end;
Button4.Enabled := true;
end;
/////////////////////////////////////////////////////////////////////////////////////
// set language
procedure TfIOPreviews.SetLanguage(l: TMsgLanguage);
begin
Caption := iemsg(IEMSG_PARAMETERSPREVIEW, l);
Label1.Caption := iemsg(IEMSG_SOURCE, l) + ':';
Label2.Caption := iemsg(IEMSG_RESULT, l) + ':';
Button2.Caption := iemsg(IEMSG_CANCEL, l);
Button1.Caption := iemsg(IEMSG_OK, l);
button3.caption := iemsg(IEMSG_PREVIEW, l);
chkLockPreview.Caption := iemsg(IEMSG_LOCKPREVIEW, l);
Button4.Caption := iemsg(IEMSG_APPLY, l);
// JPEG
Label23.Caption := iemsg(IEMSG_QUALITY, l) + ':';
Label26.Caption := iemsg(IEMSG_DCTMETHOD, l) + ':';
Label27.Caption := iemsg(IEMSG_SMOOTHINGFACTOR, l) + ':';
label57.Caption := iemsg(IEMSG_PHOTOMETRIC, l) + ':';
CheckBox2.Caption := iemsg(IEMSG_OPTIMALHUFFMAN, l);
label3.caption := iemsg(IEMSG_ORIGINALSIZE, l) + ':';
Label24.Caption := iemsg(IEMSG_COMPRESSEDSIZE, l) + ':';
GroupBox5.Caption := ' ' + iemsg(IEMSG_ADVANCED, l) + ' ';
checkbox3.caption := iemsg(IEMSG_PROGRESSIVE, l);
// JPEG-simplified
Label72.Caption := iemsg(IEMSG_QUALITY, l) + ':';
Label73.caption := iemsg(IEMSG_ORIGINALSIZE, l) + ':';
Label75.Caption := iemsg(IEMSG_COMPRESSEDSIZE, l) + ':';
// JPEG2000
{$IFDEF IEINCLUDEJPEG2000}
Label66.Caption := iemsg(IEMSG_RATE, l) + ':';
Label71.Caption := iemsg(IEMSG_PHOTOMETRIC, l) + ':';
Label67.caption := iemsg(IEMSG_ORIGINALSIZE, l) + ':';
Label69.Caption := iemsg(IEMSG_COMPRESSEDSIZE, l) + ':';
{$ENDIF}
// TIFF
label5.caption := iemsg(IEMSG_COMPRESSION, l) + ':';
label6.caption := iemsg(IEMSG_IMAGEINDEX, l) + ':';
label7.caption := iemsg(IEMSG_PHOTOMETRIC, l) + ':';
groupbox1.caption := ' ' + iemsg(IEMSG_SCANNDEDDOCUMENTINFO, l) + ' ';
label12.caption := iemsg(IEMSG_NAME, l) + ':';
label13.caption := iemsg(IEMSG_DESCRIPTION, l) + ':';
label14.caption := iemsg(IEMSG_PAGENAME, l) + ':';
label15.caption := iemsg(IEMSG_PAGENUMBER, l) + ':';
label16.caption := iemsg(IEMSG_OF, l);
label8.caption := iemsg(IEMSG_HORIZPOSITIONINCH, l) + ':';
label10.caption := iemsg(IEMSG_VERTPOSITIONINCH, l) + ':';
label9.caption := iemsg(IEMSG_ORIGINALSIZE, l) + ':';
label17.caption := iemsg(IEMSG_COMPRESSEDSIZE, l) + ':';
label19.caption := iemsg(IEMSG_COLORS, l) + ':';
// TIFF-simplified
Label81.caption := iemsg(IEMSG_COMPRESSION, l) + ':';
Label77.caption := iemsg(IEMSG_ORIGINALSIZE, l) + ':';
Label79.caption := iemsg(IEMSG_COMPRESSEDSIZE, l) + ':';
Label82.caption := iemsg(IEMSG_COLORS, l) + ':';
// GIF
label21.caption := iemsg(IEMSG_COLORS, l) + ':';
label20.caption := iemsg(IEMSG_IMAGEINDEX, l) + ':';
checkbox4.Caption := iemsg(IEMSG_TRANSPARENT, l) + ':';
label34.caption := iemsg(IEMSG_TRANSPARENTCOLOR, l) + ':';
checkbox5.caption := iemsg(IEMSG_INTERLACED, l) + ':';
label35.caption := iemsg(IEMSG_BACKGROUND, l) + ':';
groupbox2.Caption := ' ' + iemsg(IEMSG_ADVANCED, l) + ' ';
label31.caption := iemsg(IEMSG_HORIZPOSITION, l) + ':';
label32.caption := iemsg(IEMSG_VERTPOSITION, l) + ':';
label33.caption := iemsg(IEMSG_DELAYTIME, l) + ':';
label22.caption := iemsg(IEMSG_ORIGINALSIZE, l) + ':';
label29.caption := iemsg(IEMSG_COMPRESSEDSIZE, l) + ':';
// GIF-simplified
Label87.caption := iemsg(IEMSG_COLORS, l) + ':';
Label83.caption := iemsg(IEMSG_ORIGINALSIZE, l) + ':';
Label85.caption := iemsg(IEMSG_COMPRESSEDSIZE, l) + ':';
// BMP
label37.caption := iemsg(IEMSG_COMPRESSION, l) + ':';
label38.caption := iemsg(IEMSG_COLORS, l) + ':';
label39.caption := iemsg(IEMSG_ORIGINALSIZE, l) + ':';
label41.caption := iemsg(IEMSG_COMPRESSEDSIZE, l) + ':';
// PCX
label43.caption := iemsg(IEMSG_COMPRESSION, l) + ':';
label44.caption := iemsg(IEMSG_COLORS, l) + ':';
label45.caption := iemsg(IEMSG_ORIGINALSIZE, l) + ':';
label47.caption := iemsg(IEMSG_COMPRESSEDSIZE, l) + ':';
// PNG
label49.caption := iemsg(IEMSG_COLORS, l) + ':';
checkbox6.Caption := iemsg(IEMSG_INTERLACED, l);
label54.caption := iemsg(IEMSG_BACKGROUND, l) + ':';
label50.caption := iemsg(IEMSG_ORIGINALSIZE, l) + ':';
label52.caption := iemsg(IEMSG_COMPRESSEDSIZE, l) + ':';
groupbox3.Caption := ' ' + iemsg(IEMSG_ADVANCED, l) + ' ';
label55.caption := iemsg(IEMSG_FILTER, l) + ':';
label56.caption := iemsg(IEMSG_COMPRESSION, l) + ':';
// TGA
Label62.caption := iemsg(IEMSG_COLORS, l) + ':';
label63.caption := iemsg(IEMSG_BACKGROUND, l) + ':';
checkbox1.Caption := iemsg(IEMSG_COMPRESSION, l) + ':';
label64.caption := iemsg(IEMSG_NAME, l) + ':';
label65.caption := iemsg(IEMSG_DESCRIPTION, l) + ':';
label58.caption := iemsg(IEMSG_ORIGINALSIZE, l) + ':';
label60.caption := iemsg(IEMSG_COMPRESSEDSIZE, l) + ':';
//
msgCancel := '&' + iemsg(IEMSG_CANCEL, l);
end;
/////////////////////////////////////////////////////////////////////////////////////
// preview-lock
procedure TfIOPreviews.SpeedButton1Click(Sender: TObject);
begin
if chkLockPreview.Checked then
ApplyAct;
button3.enabled := not chkLockPreview.Checked; // enable/disable preview button
end;
/////////////////////////////////////////////////////////////////////////////////////
// preview
procedure TfIOPreviews.Button3Click(Sender: TObject);
begin
ApplyAct;
end;
/////////////////////////////////////////////////////////////////////////////////////
// select GIF-Transp.Color
procedure TfIOPreviews.Panel3Click(Sender: TObject);
var
fPalDial: TImageEnPaletteDialog;
begin
if imageen2.IO.Params.ColorMap = nil then
ApplyAct;
fPalDial := TImageEnPaletteDialog.Create(self);
fPalDial.SetPalette(imageen2.IO.Params.ColorMap^, 1 shl GIF_BitsPerSample);
fPalDial.ButtonCancel.Caption := msgCancel;
if fPalDial.Execute then
panel3.color := fPalDial.SelCol;
GIF_TranspColor := TCOLOR2TRGB(panel3.color);
FreeAndNil(fPalDial);
Button4.Enabled := true;
end;
/////////////////////////////////////////////////////////////////////////////////////
// select GIF-Background
procedure TfIOPreviews.Panel4Click(Sender: TObject);
var
fPalDial: TImageEnPaletteDialog;
begin
if imageen2.IO.Params.ColorMap = nil then
ApplyAct;
fPalDial := TImageEnPaletteDialog.Create(self);
fPalDial.SetPalette(imageen2.IO.Params.ColorMap^, 1 shl GIF_BitsPerSample);
fPalDial.ButtonCancel.Caption := msgCancel;
if fPalDial.Execute then
panel4.color := fPalDial.SelCol;
GIF_Background := TCOLOR2TRGB(panel4.color);
FreeAndNil(fPalDial);
Button4.Enabled := true;
end;
/////////////////////////////////////////////////////////////////////////////////////
// OK
procedure TfIOPreviews.Button1Click(Sender: TObject);
begin
if (PageControl1.ActivePage = TabSheetJPEG1) or (PageControl1.ActivePage = TabSheetJPEG2) then
begin
// READ JPEG PARAMETERS
fParams.JPEG_Quality := JPEG_Quality;
fParams.JPEG_ColorSpace := TIOJPEGColorspace(JPEG_Photometric);
case JPEG_DCTMethod of
0: fParams.JPEG_DCTMethod := ioJPEG_ISLOW;
1: fParams.JPEG_DCTMethod := ioJPEG_IFAST;
2: fParams.JPEG_DCTMethod := ioJPEG_FLOAT;
end;
fParams.JPEG_OptimalHuffman := JPEG_OptimalHuffman;
fParams.JPEG_Smooth := JPEG_Smooth;
fParams.JPEG_Progressive := JPEG_Progressive;
fParams.FileType := ioJPEG;
end
else if (PageControl1.ActivePage = TabSheetTIFF1) or (PageControl1.ActivePage = TabSheetTIFF2) then
begin
// READ TIFF PARAMETERS
fParams.TIFF_Compression := TIFF_Compression;
fParams.TIFF_ImageIndex := TIFF_ImageIndex;
fParams.TIFF_PhotometInterpret := TIFF_PhotometInterpret;
fParams.TIFF_XPos := TIFF_XPos;
fParams.TIFF_YPos := TIFF_YPos;
fParams.TIFF_DocumentName := TIFF_DocumentName;
fParams.TIFF_ImageDescription := TIFF_ImageDescription;
fParams.TIFF_PageName := TIFF_PageName;
fParams.TIFF_PageNumber := TIFF_PageNumber;
fParams.TIFF_PageCount := TIFF_PageCount;
fParams.SamplesPerPixel := TIFF_SamplesPerPixel;
fParams.BitsPerSample := TIFF_BitsPerSample;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -