⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iemio.pas

📁 ·ImageEn 2.3.0 ImageEn一组用于图像处理、查看和分析的Delphi控件。能够保存几种图像格式
💻 PAS
📖 第 1 页 / 共 2 页
字号:
(*
Copyright (c) 1998-2007 by HiComponents. All rights reserved.

This software comes without express or implied warranty.
In no case shall the author be liable for any damage or unwanted behavior of any
computer hardware and/or software.

HiComponents grants you the right to include the compiled component
in your application, whether COMMERCIAL, SHAREWARE, or FREEWARE,
BUT YOU MAY NOT DISTRIBUTE THIS SOURCE CODE OR ITS COMPILED .DCU IN ANY FORM.

ImageEn, IEvolution and ImageEn ActiveX may not be included in any commercial,
shareware or freeware libraries or components.

email: support@hicomponents.com

http://www.hicomponents.com
*)

unit iemio;

{$R-}
{$Q-}

{$I ie.inc}

{$IFDEF IEINCLUDEMULTIVIEW}

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  ImageEnView, ImageEnProc, ExtCtrls, hyiedefs, ImageEnIO, ieview,
{$IFDEF IEINCLUDEWIA}
  iewia,
{$ENDIF}
  hyieutils, pcxfilter;

type

{!!
<FS>TImageEnMIO

<FM>Description<FN>
TImageEnMIO loads/saves and acquires multi-images. It must be attached to <A TImageEnMView>.
TImageEnMIO can load animated GIF, multi-image TIFF, AVI and acquire multi-page from TWain scanners.
It can also save animated GIF, multi-images TIFF and AVI.

Note: Users often attach a <A TImageEnIO> component to <A TImageEnMView> component. This is not correct. The TImageEnMIO component must be attached only to a <A TImageEnMView> component.

<FM>Properties<FN>

  <A TImageEnMIO.Aborting>
  <A TImageEnMIO.AttachedMView>
  <A TImageEnMIO.AutoAdjustDPI>
  <A TImageEnMIO.DefaultDitherMethod>
  <A TImageEnMIO.DialogsMeasureUnit>
  <A TImageEnMIO.FilteredAdjustDPI>
  <A TImageEnMIO.MsgLanguage>
  <A TImageEnMIO.NativePixelFormat>
  <A TImageEnMIO.ParamsCount>
  <A TImageEnMIO.Params>
  <A TImageEnMIO.PreviewFont>
  <A TImageEnMIO.PreviewsParams>
  <A TImageEnMIO.PrintingFilterOnSubsampling>
  <A TImageEnMIO.ProxyAddress>
  <A TImageEnMIO.ProxyPassword>
  <A TImageEnMIO.ProxyUser>
  <A TImageEnMIO.SimplifiedParamsDialogs>
  <A TImageEnMIO.TWainParams>
  <A TImageEnMIO.WIAParams>


<FM>Methods<FN>

  <A TImageEnMIO.AcquireClose>
  <A TImageEnMIO.AcquireOpen>
  <A TImageEnMIO.Acquire>
  <A TImageEnMIO.DoPreviews>
  <A TImageEnMIO.DoPrintPreviewDialog>
  <A TImageEnMIO.DuplicateCompressionInfo>
  <A TImageEnMIO.ExecuteOpenDialog>
  <A TImageEnMIO.ExecuteSaveDialog>
  <A TImageEnMIO.LoadFromFileAuto>
  <A TImageEnMIO.LoadFromFileAVI>
  <A TImageEnMIO.LoadFromFileDCX>
  <A TImageEnMIO.LoadFromFileFormat>
  <A TImageEnMIO.LoadFromFileGIF>
  <A TImageEnMIO.LoadFromFileICO>
  <A TImageEnMIO.LoadFromFileTIFF>
  <A TImageEnMIO.LoadFromFile>
  <A TImageEnMIO.LoadFromMediaFile>
  <A TImageEnMIO.LoadFromStreamDCX>
  <A TImageEnMIO.LoadFromStreamFormat>
  <A TImageEnMIO.LoadFromStreamGIF>
  <A TImageEnMIO.LoadFromStreamICO>
  <A TImageEnMIO.LoadFromStreamTIFF>
  <A TImageEnMIO.LoadFromStream>
  <A TImageEnMIO.LoadFromURL>
  <A TImageEnMIO.SaveToFileAVI>
  <A TImageEnMIO.SaveToFileDCX>
  <A TImageEnMIO.SaveToFileGIF>
  <A TImageEnMIO.SaveToFilePDF>
  <A TImageEnMIO.SaveToFilePS>
  <A TImageEnMIO.SaveToFileTIFF>
  <A TImageEnMIO.SaveToFile>
  <A TImageEnMIO.SaveToStreamDCX>
  <A TImageEnMIO.SaveToStreamGIF>
  <A TImageEnMIO.SaveToStreamPDF>
  <A TImageEnMIO.SaveToStreamPS>
  <A TImageEnMIO.SaveToStreamTIFF>
  <A TImageEnMIO.SelectAcquireSource>
  <A TImageEnMIO.Update>

<FM>Events<FN>

  <A TImageEnMIO.OnAcquireBitmap>
  <A TImageEnMIO.OnDoPreviews>
  <A TImageEnMIO.OnFinishWork>
  <A TImageEnMIO.OnProgress>
!!}
  TImageEnMIO = class(TComponent)
  private
    { Private declarations }
    fImageEnMView: TIEView;
    fImageEnMViewIdx: integer; // bitmap change index (-1=nothing)
    fParams: TList; // list of TIOParamasVals
    fSimplifiedParamsDialogs: boolean;
{$IFDEF IEINCLUDETWAIN}
    fTwainParams: TIETWainParams;
{$ENDIF}
    // WIA
{$IFDEF IEINCLUDEWIA}
    fWIA: TIEWia;
{$ENDIF}
    fMsgLanguage: TMsgLanguage;
    fPreviewsParams: TIOPreviewsParams;
    fPreviewFont: TFont;
    fTWainNextToInsert: integer; // index of next image to insert (twain multipage acq.)
    fAutoAdjustDPI: boolean;
    fFilteredAdjustDPI: boolean;
    fDefaultDitherMethod: TIEDitherMethod;
    fResetPrinter: boolean;
    fDialogsMeasureUnit: TIEDialogsMeasureUnit;
    fNativePixelFormat:boolean;
    fPrintingFilterOnSubsampling: TResampleFilter;
    fOnDoPreviews: TIEDoPreviewsEvent;
    // TWain modeless
    fgrec: pointer;
    // proxy settings
    fProxyAddress, fProxyUser, fProxyPassword: string;
    //
    procedure SetAttachedMView(v: TIEView);
    procedure RemoveIOParam(idx: integer);
    procedure InsertIOParam(idx: integer);
    procedure MoveIOParams(idx:integer; destination:integer);
    procedure SwapIOParams(idx1,idx2:integer);
    function GetParams(idx: integer): TIOParamsVals;
    procedure SetPreviewFont(f: TFont);
    function GetParamsCount: integer;
    procedure SetIOPreviewParams(v: TIOPreviewsParams);
    function GetIOPreviewParams: TIOPreviewsParams;
  protected
    { Protected declarations }
    fAborting: boolean;
    fOnProgress: TIEProgressEvent;
    fOnAcquireBitmap: TIEAcquireBitmapEvent;
    fOnFinishWork: TNotifyEvent;
    procedure TWMultiCallBack(Bitmap: TIEBitmap; var IOParams: TObject); virtual;
    procedure TWCloseCallBack; virtual;
    procedure Notification(AComponent: TComponent; Operation: TOperation); override;
    procedure OnBitmapChange(Sender: TObject; destroying: boolean);
    procedure DoFinishWork; virtual;
{$IFDEF IEINCLUDEWIA}
    function GetWIAParams: TIEWia; virtual;
{$ENDIF}
    procedure CheckDPI(p: TIOParamsVals);
  public
    { Public declarations }
    constructor Create(Owner: TComponent); override;
    destructor Destroy; override;
    procedure Update;

{!!
<FS>TImageEnMIO.DefaultDitherMethod

<FM>Declaration<FC>
property DefaultDitherMethod:<A TIEDitherMethod>;

<FM>Description<FN>
DefaultDitherMethod specifies the default dithering method to apply when a color image needs to be converted to black/white.
ieThreshold is the default.
!!}
    property DefaultDitherMethod: TIEDitherMethod read fDefaultDitherMethod write fDefaultDitherMethod;

    // Other
    property Params[idx: integer]: TIOParamsVals read GetParams;
    property ParamsCount: integer read GetParamsCount;
    procedure DuplicateCompressionInfo;
{$IFDEF IEINCLUDEDIALOGIO}
    function DoPreviews(idx: integer; pp: TPreviewParams): boolean;
{$ENDIF}
{$IFDEF IEINCLUDETWAIN}

{!!
<FS>TImageEnMIO.TWainParams

<FM>Declaration<FC>
property TWainParams:<A TIETWainParams>;

<FM>Description<FN>
Use the TWainParams property to control scanner acquisition. You can enable/disable standard user interface, set pixeltype (Grayscale, RGB...), DPI, or select the acquire scanner without user interaction.
Look at <A TIETWainParams> object for more details.

<FM>Example<FC>

// Acquires a black/white (1bit) image
ImageEnMView1.MIO.TWainParams.PixelType.CurrentValue:=0;
ImageEnMView1.MIO.TWainParams.VisibleDialog:=False;
ImageEnMView1.MIO.Acquire;
!!}
    property TWainParams: TIETWainParams read fTWainParams;

{$ENDIF}
{$IFDEF IEINCLUDEWIA}
    property WIAParams: TIEWia read GetWIAParams;
{$ENDIF}

{!!
<FS>TImageEnMIO.Aborting

<FM>Declaration<FC>
property Aborting: boolean;

<FM>Description<FN>
Applications can abort save/load processing by assigning True to the Aborting property. On loading, the image will be truncated. On saving, the file will be closed and truncated (and will be unreadable).
You can also read the <A TImageEnMIO.Aborting> property to know when aborting is in progress.
!!}
    property Aborting: boolean read fAborting write fAborting;

    // GIF
    procedure LoadFromFileGIF(const nf: string);
    procedure LoadFromStreamGIF(Stream: TStream);
    procedure SaveToFileGIF(const nf: string);
    procedure SaveToStreamGIF(Stream: TStream);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -