📄 imageenview.pas
字号:
(*
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 imageenview;
{$R-}
{$Q-}
{$HINTS OFF}
interface
{$I ie.inc}
uses
Windows, Messages, Graphics, Controls, Forms, Classes, SysUtils, StdCtrls,
ExtCtrls, hyiedefs, hyieutils, imageenio, imageenproc, ieview;
type
{!!
<FS>TIEGrip
<FM>Declaration<FC>
}
TIEGrip = (ieNone, ieTopLeft, ieTopRight, ieBottomRight, ieBottomLeft, ieLeftSide, ieRightSide, ieTopSide, ieBottomSide);
{!!}
{!!
<FS>TIEAlignment
<FM>Declaration<FC>
}
TIEAlignment = (iejLeft, iejRight, iejCenter, iejJustify);
{!!}
{!!
<FS>TViewChangeEvent
<FM>Declaration<FC>
type TViewChangeEvent = procedure(Sender: TObject; Change: integer) of object;
<FM>Description<FN>
If Change = 0 the event is ViewX or ViewY modification.
If Change = 1 the event is Zoom modification.
Note: a Zoom could also modify ViewX/Y.
!!}
TViewChangeEvent = procedure(Sender: TObject; Change: integer) of object;
{!!
<FS>TIEMouseInResizingGripEvent
<FM>Declaration<FC>
TIEMouseInResizingGripEvent = procedure(Sender: TObject; Grip: <A TIEGrip>) of object;
!!}
TIEMouseInResizingGripEvent = procedure(Sender: TObject; Grip: TIEGrip) of object;
{!!
<FS>TIEZoomEvent
<FM>Declaration<FC>
}
TIEZoomEvent = procedure(Sender: TObject; var NewZoom: double) of object;
{!!}
{!!
<FS>TIESpecialKeyEvent
<FM>Declaration<FC>
}
TIESpecialKeyEvent = procedure(Sender: TObject; CharCode:word; Shift:TShiftState; var Handled:boolean) of object;
{!!}
TIEScrollCommand = (iescPosition, iescBottom, iescTop, iescLineDown, iescLineUp, iescPageDown, iescPageUp);
TIEOnDrawCanvas = procedure(Sender: TObject; ACanvas:TCanvas; ARect:TRect) of object;
TIEOnDrawBackground = procedure(Sender: TObject; ACanvas:TCanvas; ARect:TRect; var Handled: boolean) of object;
TIEOnDrawPolygon = procedure(Sender:TObject; polygon:integer; point:integer; Canvas:TCanvas; x,y:integer) of object;
{!!
<FS>TIEWallPaperStyle
<FM>Declaration<FC>
TIEWallPaperStyle = (iewoNormal, iewoStretch, iewoTile);
<FM>Description<FN>
<TABLE>
<R> <H>Value</H> <H>Description</H> </R>
<R> <C>iewoNormal</C> <C>paint the wall paper image at the top left side</C> </R>
<R> <C>iewoStretch</C> <C>paint the wall paper stretching to the component size</C> </R>
<R> <C>iewoTile</C> <C>paint the wall paper tiled to the component size</C> </R>
</TABLE>
!!}
TIEWallPaperStyle = (iewoNormal, iewoStretch, iewoTile);
{!!
<FS>TIEMouseInteractItems
<FM>Declaration<FC>
TIEMouseInteractItems = (miZoom, miScroll, miSelect, miSelectPolygon, miSelectCircle, miSelectZoom, miSelectMagicWand, miSelectLasso, miMoveLayers, miResizeLayers );
<FM>Description<FN>
<TABLE>
<R> <H>Value</H> <H>Description</H> </R>
<R> <C>miZoom</C> <C>the left click zoom-in the image, otherwise right click zoom-out.</C> </R>
<R> <C>miScroll</C> <C>the user can navigate the image with a left click and mouse movement.</C> </R>
<R> <C>miSelect</C> <C>the user can select a rectangular area. Click and move mouse to select the rectangle. miSelect excludes miScroll and miSelectXXX. SHIFT key allows selection of multiple regions. Simultaneously pressing ALT causes the selection to maintain its aspect ratio.</C> </R>
<R> <C>miSelectZoom</C> <C>the user can select an area, which will be zoomed-in. Click and move mouse to zoom the rectangle.</C> </R>
<R> <C>miSelectPolygon</C> <C>the user can select a polygonal area. Press and release left mouse button for each vertex of polygon, otherwise press left button and move mouse to specify continuous irregular lines. The SHIFT key selects multiple regions.</C> </R>
<R> <C>miSelectCircle</C> <C>the user can select a circular (ellipse) area. Press left button and move mouse (press ALT to select a circle). SHIFT key selects multiple regions.</C> </R>
<R> <C>miSelectMagicWand</C> <C>the user can select an irregular region with similar colors. Press and release the left button over a point. SHIFT key selects multiple regions.</C> </R>
<R> <C>miSelectLasso</C> <C>the user can select a polygonal area. Press the left button and move mouse to specify continuous irregular region.</C> </R>
<R> <C>miMoveLayers</C> <C>the user can move layers. LayersSync must be False.</C> </R>
<R> <C>miResizeLayers</C> <C>the user can resize layers using grips. LayersSync must be False.</C> </R>
</TABLE>
!!}
TIEMouseInteractItems = (
miZoom, // Click-sx zoom-in / click-dx zoom-out
miScroll, // Hand navigation
miSelect, // Rectangular selection
miSelectPolygon, // Polygonal selection
miSelectCircle, // Circular selection
miSelectZoom, // Zoom in rectangle
miSelectMagicWand, // Magic Wand selection
miSelectLasso, // Polygonal selection
miMoveLayers, // Move layers
miResizeLayers // Resize layers
);
{!!
<FS>TIEMouseInteract
<FM>Declaration<FC>
type TIEMouseInteract = set of <A TIEMouseInteractItems>;
!!}
TIEMouseInteract = set of TIEMouseInteractItems;
{!!
<FS>TIESelectionBase
<FM>Declaration<FC>
}
TIESelectionBase = (
iesbClientArea, // select coordinates over client area
iesbBitmap // select coordinates over bitmap
);
{!!}
{!!
<FS>TIEBackgroundStyle
<FM>Declaration<FC>
TIEBackgroundStyle = (iebsSolid, iebsHorizontal, iebsVertical, iebsFDiagonal, iebsBDiagonal, iebsCross, iebsDiagCross, iebsChessboard, iebsDiagonals, iebsCropped, iebsCropShadow, iebsGradient, iebsSoftShadow, iebsPhotoLike);
<FM>Description<FN>
<TABLE>
<R> <H>Value</H> <H>Description</H> </R>
<R> <C>iebsCropped</C> <C>3d border around the image (instead of around the component). We suggest that BorderStyle is bsNone and Center is True.</C> </R>
<R> <C>iebsCropShadow</C> <C>shadow around the image</C> </R>
<R> <C>iebsChessboard</C> <C>a chessboard picture</C> </R>
<R> <C>iebsDiagonals</C> <C>two diagonals</C> </R>
<R> <C>iebsSolid</C> <C>like bsSolid of TBrushStyle</C> </R>
<R> <C>iebsHorizontal</C> <C>like bsHorizontal of TBrushStyle</C> </R>
<R> <C>iebsVertical</C> <C>like bsVertical of TBrushStyle</C> </R>
<R> <C>iebsFDiagonal</C> <C>like bsFDiagonal of TBrushStyle</C> </R>
<R> <C>iebsBDiagonal</C> <C>like bsBDiagonal of TBrushStyle</C> </R>
<R> <C>iebsCross</C> <C>like bsCross of TBrushStyle</C> </R>
<R> <C>iebsDiagCross</C> <C>like bsDiagCross of TBrushStyle</C> </R>
<R> <C>iebsGradient</C> <C>a gradient (only Windows98/Me/2000/Xp)</C> </R>
<R> <C>iebsSoftShadow</C> <C>soft (gaussian) shadow around the image</C> </R>
<R> <C>iebsPhotoLike</C> <C>a chessboard inside the image with a black border around</C> </R>
</TABLE>
!!}
TIEBackgroundStyle = (iebsSolid, iebsHorizontal, iebsVertical, iebsFDiagonal, iebsBDiagonal, iebsCross, iebsDiagCross, iebsChessboard, iebsDiagonals, iebsCropped, iebsCropShadow, iebsGradient, iebsSoftShadow, iebsPhotoLike);
{!!
<FS>TIESelectionOptions
<FM>Declaration<FC>
type TIESelectionOptions=set of (iesoAnimated, iesoSizeable, iesoMoveable, iesoFilled, iesoCutBorders, iesoMarkOuter, iesoCanScroll, iesoSelectTranspLayers);
<FM>Description<FN>
<TABLE>
<R> <H>Value</H> <H>Description</H> </R>
<R> <C>iesoAnimated</C> <C>the selection will be animated.</C> </R>
<R> <C>iesoSizeable</C> <C>user can resize the selection (display grips).</C> </R>
<R> <C>iesoMoveable</C> <C>user can move the selection (display grips).</C> </R>
<R> <C>iesoFilled</C> <C>the selection in filled with inverted image</C> </R>
<R> <C>iesoCutBorders</C> <C>user can drag the selection out of borders (cut the selection borders)</C> </R>
<R> <C>iesoMarkOuter</C> <C>makes grayed the unselected area (the area out of selection)</C> </R>
<R> <C>iesoCanScroll</C> <C>enables auto-scrolling of the image when selecting out of visible area</C> </R>
<R> <C>iesoSelectTranspLayers : if specified transparent areas of a layer are selectable</C> </R>
</TABLE>
!!}
TIESelectionOptions = set of (iesoAnimated, iesoSizeable, iesoMoveable, iesoFilled, iesoCutBorders, iesoMarkOuter, iesoCanScroll, iesoSelectTranspLayers);
{!!
<FS>TIESelOp
<FM>Declaration<FC>
TIESelOp = (iespReplace, iespAdd);
<FM>Description<FN>
iespReplace replaces all previous selections.
iespAdd adds a new selection.
!!}
TIESelOp = (iespReplace, iespAdd);
{!!
<FS>TIEMagicWandMode
<FM>Declaration<FC>
TIEMagicWandMode=(iewInclusive, iewExclusive, iewGlobal);
<FM>Description<FN>
<TABLE>
<R> <H>Value</H> <H>Description</H> </R>
<R> <C>iewInclusive</C> <C>the selection is a closed polygon.</C> </R>
<R> <C>iewExclusive</C> <C>the selection includes only points that match the initial pixel, like a flood fill</C> </R>
<R> <C>iewGlobal</C> <C>the selection includes all points that match the initial pixel, looking for all pixels in the image.</C> </R>
</TABLE>
!!}
TIEMagicWandMode = (iewInclusive, iewExclusive, iewGlobal);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// TIEVSoftShadow
{!!
<FS>TIEVSoftShadow
<FM>Description<FN>
This class specifies how a shadow will be rendered.
<FM>Fields<FN>
<A TIEVSoftShadow.Enabled>
<A TIEVSoftShadow.Radius>
<A TIEVSoftShadow.OffsetX>
<A TIEVSoftShadow.OffsetY>
!!}
TIEVSoftShadow = class
{!!
<FS>TIEVSoftShadow.Enabled
<FM>Declaration<FC>
Enabled:boolean
<FM>Description<FN>
Enables/disables the shadow.
!!}
Enabled: boolean;
{!!
<FS>TIEVSoftShadow.Radius
<FM>Declaration<FC>
Radius:double
<FM>Description<FN>
Sets the radius of the shadow.
!!}
Radius: double;
{!!
<FS>TIEVSoftShadow.OffsetX
<FM>Declaration<FC>
OffsetX:integer
<FM>Description<FN>
Specifies the horizontal relative position of the shadow.
!!}
OffsetX: integer;
{!!
<FS>TIEVSoftShadow.OffsetY
<FM>Declaration<FC>
OffsetY:integer
<FM>Description<FN>
Specifies the vertical relative position of the shadow.
!!}
OffsetY: integer;
end;
// TIEVSoftShadow
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
{!!
<FS>TIEMagnifyStyle
<FM>Declaration<FC>
}
TIEMagnifyStyle = (iemRectangle, iemEllipse);
{!!}
{!!
<FS>TIEMagnifySource
<FM>Declaration<FC>
TIEMagnifySource = (iemBackgroundLayer, iemCanvas);
<FM>Description<FN>
iemBackgroundLayer gets data from the background layer.
iemCanvas gets data from the painted background.
If you want the magnify the layer 0 image, getting pixels directly from the bitmap use iemBackgroundLayer.
!!}
TIEMagnifySource = (iemBackgroundLayer, iemCanvas);
{!!
<FS>TIELayerMagnification
<FM>Declaration<FC>
TIELayerMagnification = record
Enabled: boolean;
Rate: double;
Style: <A TIEMagnifyStyle>;
Source: <A TIEMagnifySource>;
end;
<FM>Description<FN>
<TABLE>
<R> <H>Field</H> <H>Description</H> </R>
<R> <C>Enabled</C> <C>If true this is a magnify layer. The bitmap of the layer is filled with the background zoomed according to Rate field. Valid only if <A TImageEnView.LayersSync>=False. This property doesn't apply to layer 0.</C> </R>
<R> <C>Rate</C> <C>Specifies the rate of the magnify layer (magnification). Allowed values greather than 1. Valid only if Enabled=True and LayersSync=False. This property doesn't apply to layer 0.</C> </R>
<R> <C>Style</C> <C>Specifies the magnify layer shape. Valid only if Enabled=True and LayersSync=False. This property doesn't apply to layer 0.</C> </R>
<R> <C>Source</C> <C>Specifies the magnify layer source. </C> </R>
</TABLE>
!!}
TIELayerMagnification = record
Enabled: boolean;
Rate: double; // must be >=1
Style: TIEMagnifyStyle;
Source: TIEMagnifySource;
end;
{!!
<FS>TIEDrawingInfo
<FM>Declaration<FC>
}
TIEDrawingInfo=record
XDst:integer; // destination x (output canvas)
YDst:integer; // destination y (output canvas)
WidthDst:integer; // destionation width (output canvas)
HeightDst:integer; // destionation height (output canvas)
XSrc:integer; // source x (input bitmap)
YSrc:integer; // source y (input bitmap)
WidthSrc:integer; // source width (input bitmap)
HeightSrc:integer; // source height (input bitmap)
end;
{!!}
{!!
<FS>TIEDrawLayerBoxEvent
<FM>Declaration<FC>
}
TIEDrawLayerBoxEvent = procedure (Sender:TObject; ABitmap: TBitmap; layer: integer) of object;
{!!}
{!!
<FS>TIEDrawLayerGrip
<FM>Declaration<FC>
}
TIEDrawLayerGrip = procedure (Sender:TObject; ABitmap: TBitmap; layer: integer; grip:integer; rect:TRect) of object;
{!!}
{!!
<FS>TIELayer
<FM>Description<FN>
This class contains a single layer of <A TImageEnView> object. A layer has a TIEBitmap, position, size, transparency and other properties.
You should create new layers using <A TImageEnView.LayersAdd>.
<FM>Methods<FN>
<A TIELayer.ConvXScr2Bmp>
<A TIELayer.ConvYScr2Bmp>
<A TIELayer.ConvXBmp2Scr>
<A TIELayer.ConvYBmp2Scr>
<A TIELayer.Assign>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -