📄 hyieutils.pas
字号:
destructor Destroy; override;
end;
<FM>Description<FN>
Internal representation of an imaging object.
!!}
TIEImagingObject = class
private
attrib: OIAN_MARK_ATTRIBUTES;
points: PIEPointArray;
pointsLen: integer;
text: pchar;
image: TIEBitmap;
public
constructor Create;
destructor Destroy; override;
end;
{!!
<FS>TIEImagingAnnot
<FM>Description<FN>
ImagingAnnot contains the (Wang) imaging annotations loaded (or to save) from a TIFF.
Using <A TIEImagingAnnot> object you can create new objects, copy to a <A TImageEnVect> (as vectorial objects), copy from a <A TImageEnVect> (from vectorial objects) or just draw on the bitmap.
<FM>Methods<FN>
<A TIEImagingAnnot.Assign>
<A TIEImagingAnnot.Clear>
<A TIEImagingAnnot.CopyFromTImageEnVect>
<A TIEImagingAnnot.CopyToTImageEnVect>
<A TIEImagingAnnot.DrawToBitmap>
<A TIEImagingAnnot.LoadFromStandardBuffer>
<A TIEImagingAnnot.LoadFromStream>
<A TIEImagingAnnot.SaveToStandardBuffer>
<A TIEImagingAnnot.SaveToStream>
<FM>Properties<FN>
<A TIEImagingAnnot.Objects>
<A TIEImagingAnnot.ObjectsCount>
!!}
TIEImagingAnnot = class
private
fParent:TObject; // optional parent object
fUserChanged: boolean;
fObjects: TList;
function GetObject(idx: integer): TIEImagingObject;
function GetObjectsCount: integer;
public
constructor Create;
destructor Destroy; override;
procedure LoadFromStandardBuffer(buffer: pointer; buflen: integer);
procedure SaveToStandardBuffer(var Buffer: pointer; var BufferLength: integer);
property UserChanged: boolean read fUserChanged write fUserChanged;
procedure Clear;
procedure Assign(Source: TIEImagingAnnot);
procedure SaveToStream(Stream: TStream);
procedure LoadFromStream(Stream: TStream);
procedure CopyToTImageEnVect(Target: TObject=nil);
procedure CopyFromTImageEnVect(Target: TObject=nil);
procedure DrawToBitmap(target: TIEBitmap; Antialias: boolean);
property Objects[idx: integer]: TIEImagingObject read GetObject;
property ObjectsCount: integer read GetObjectsCount;
property Parent:TObject read fParent write fParent;
end;
{!!
<FS>TIEMask
<FM>Description<FN>
TIEMask contains a selection, which is a map of selected and unselected pixels.
A selection map can have a depth of 1 bit or 8 bit.
For a map of 1 bit, 0 is a non selected pixel, while 1 is selected.
For a map of 8 bit, 0 is non selected pixel, >0 is "semi" selected pixel up to 255 that means fully selected pixel.
<A TImageEnView> component uses this class to store current selection in <A TImageEnView.SelectionMask> property.
<FM>Methods<FN>
<A TIEMask.AllocateBits>
<A TIEMask.Assign>
<A TIEMask.CombineWithAlpha>
<A TIEMask.CopyBitmap>
<A TIEMask.CopyIEBitmap>
<A TIEMask.CopyIEBitmapAlpha>
<A TIEMask.DrawOuter>
<A TIEMask.DrawOutline>
<A TIEMask.DrawPolygon>
<A TIEMask.Empty>
<A TIEMask.Fill>
<A TIEMask.FreeBits>
<A TIEMask.GetPixel>
<A TIEMask.Intersect>
<A TIEMask.InvertCanvas>
<A TIEMask.IsPointInside>
<A TIEMask.Negative>
<A TIEMask.Resize>
<A TIEMask.SetPixel>
<A TIEMask.SyncFull>
<A TIEMask.SyncRect>
<A TIEMask.TranslateBitmap>
<A TIEMask.IsEmpty>
<FM>Properties<FN>
<A TIEMask.Bits>
<A TIEMask.BitsPerPixel>
<A TIEMask.Full>
<A TIEMask.Height>
<A TIEMask.Rowlen>
<A TIEMask.ScanLine>
<A TIEMask.Width>
<A TIEMask.X1>
<A TIEMask.X2>
<A TIEMask.Y1>
<A TIEMask.Y2>
!!}
TIEMask = class
private
fWidth: integer; // width of bit mask
fHeight: integer; // height of bit mask
fBitsperpixel: integer; // max 8 bits per pixel
fRowlen: integer; // len in bytes of a row
fBits: pbyte; // bit mask (0=not selected, 1=selected)
fX1, fY1, fX2, fY2: integer; // bounding rect
fBitmapInfoHeader1: TBitmapInfoHeader256;
fTmpBmp: pbyte; // used by DrawOutline
fTmpBmpWidth, fTmpBmpHeight: integer; // used by DrawOutline
fTmpBmpScanline: ppointerarray; // used by DrawOutline
fFull: boolean; // true if all pixels are 1 or 255
function DrawHorizontalLine(Alpha: integer; xleft, xright, y: integer): integer;
procedure DrawSinglePolygon(Alpha: integer; SelPoly: PPointArray; SelPolyCount: integer);
function GetScanLine(Row: integer): pointer;
protected
public
constructor Create;
destructor Destroy; override;
procedure SetPixel(x, y: integer; Alpha: integer);
function GetPixel(x, y: integer): integer;
procedure AllocateBits(width, height: integer; bitsperpixel: integer);
procedure Resize(NewWidth, NewHeight: integer);
procedure FreeBits;
procedure CopyBitmap(Dest, Source: TBitmap; dstonlymask, srconlymask: boolean);
procedure CopyIEBitmap(Dest, Source: TIEBitmap; dstonlymask, srconlymask: boolean; UseAlphaChannel: boolean);
procedure CopyIEBitmapAlpha(Dest, Source: TIEBitmap; dstonlymask, srconlymask: boolean);
procedure DrawPolygon(Alpha: integer; SelPoly: PPointArray; SelPolyCount: integer);
procedure CombineWithAlpha(SourceAlpha:TIEBitmap; ox,oy:integer; SynchronizeBoundingRect:boolean);
procedure Fill(Alpha: integer);
procedure Empty;
function IsPointInside(x, y: integer): boolean;
procedure TranslateBitmap(var ox, oy: integer; CutSel: boolean);
procedure InvertCanvas(Dest: TCanvas; xDst, yDst, dxDst, dyDst: integer; xMask, yMask, dxMask, dyMask: integer);
procedure DrawOuter(Dest: TBitmap; xDst, yDst, dxDst, dyDst: integer; xMask, yMask, dxMask, dyMask: integer);
procedure DrawOutline(Dest: TCanvas; xDst, yDst, dxDst, dyDst: integer; xMask, yMask, dxMask, dyMask: integer; AniCounter: integer; Color1, Color2: TColor);
procedure Negative(MaxVal: integer);
procedure SyncFull; // set Full to True if all values are 255
procedure SyncRect; // set X1,Y1,X2,Y2
procedure Intersect(x1,y1,x2,y2:integer);
{!!
<FS>TIEMask.Width
<FM>Declaration<FC>
property Width:integer;
<FM>Description<FN>
Width of the selection mask. It must be equal to the image width. (readonly)
!!}
property Width: integer read fWidth;
{!!
<FS>TIEMask.Height
<FM>Declaration<FC>
property Height:integer;
<FM>Description<FN>
Height of the selection mask. It must be equal to the image height. (readonly)
!!}
property Height: integer read fHeight;
{!!
<FS>TIEMask.BitsPerPixel
<FM>Declaration<FC>
property BitsPerPixel:integer;
<FM>Description<FN>
Bits per pixels of the mask. ImageEn supports only 1 bit selection masks (1 selected, 0 not selected). (readonly)
!!}
property BitsPerPixel: integer read fBitsPerPixel;
{!!
<FS>TIEMask.X1
<FM>Declaration<FC>
property X1:integer;
<FM>Description<FN>
Left-up side of the non-empty selection (an empty mask has 1).
!!}
property X1: integer read fX1 write fX1;
{!!
<FS>TIEMask.Y1
<FM>Declaration<FC>
property Y1:integer;
<FM>Description<FN>
Left-up side of the non-empty selection (an empty mask has 1).
!!}
property Y1: integer read fY1 write fY1;
{!!
<FS>TIEMask.X2
<FM>Declaration<FC>
property X2:integer;
<FM>Description<FN>
Right-bottom side of the non-empty selection.
!!}
property X2: integer read fX2 write fX2;
{!!
<FS>TIEMask.Y2
<FM>Declaration<FC>
property Y2:integer;
<FM>Description<FN>
Right-bottom side of the non-empty selection.
!!}
property Y2: integer read fY2 write fY2;
function IsEmpty: boolean;
property ScanLine[row: integer]: pointer read GetScanLine;
procedure Assign(Source: TIEMask);
{!!
<FS>TIEMask.Rowlen
<FM>Declaration<FC>
property Rowlen:integer;
<FM>Description<FN>
The length of a row in bytes. (readonly)
!!}
property Rowlen: integer read fRowlen;
{!!
<FS>TIEMask.Bits
<FM>Declaration<FC>
property Bits:pbyte;
<FM>Description<FN>
Contains the raw buffer of the selection mask.
!!}
property Bits: pbyte read fBits;
{!!
<FS>TIEMask.Full
<FM>Declaration<FC>
property Full:boolean;
<FM>Description<FN>
Is True when the mask contains all 1 values (that is the image has all pixels selected).
!!}
property Full: boolean read fFull write fFull;
end;
{!!
<FS>TIEPixelFormat
<FM>Declaration<FC>
}
TIEPixelFormat = (ienull,
ie1g, // gray scale (black/white)
ie8p, // color (palette)
ie8g, // gray scale (256 levels)
ie16g, // gray scale (65536 levels)
ie24RGB, // RGB 24 bit (8 bit per channel)
ie32f, // float point values, 32 bit - Single in Pascal - gray scale
ieCMYK, // CMYK (reversed 8 bit values)
ie48RGB, // RGB 48 bit (16 bit per channel)
ieCIELab // CIELab (8 bit per channel)
);
{!!}
{!!
<FS>TIEPixelFormatSet
<FM>Declaration<FC>
}
TIEPixelFormatSet = set of TIEPixelFormat;
{!!}
{!!
<FS>TIEDataAccess
<FM>Declaration<FC>
}
TIEDataAccess = set of (iedRead, iedWrite);
{!!}
{!!
<FS>TIEBaseBitmap
<FM>Description<FN>
This is the base abstract class for <A TIEBitmap> object. Applications cannot create TIEBaseBitmap objects, instead use TIEBitmap.
<FM>Implemented Properties<FN>
<A TIEBaseBitmap.Access>
<A TIEBaseBitmap.Palette>
<A TIEBaseBitmap.PaletteLength>
!!}
TIEBaseBitmap = class
protected
fAccess: TIEDataAccess;
function GetScanLine(Row: integer): pointer; virtual; abstract;
function GetBitCount: integer; virtual; abstract;
function GetHeight: integer; virtual; abstract;
function GetWidth: integer; virtual; abstract;
function GetPixelFormat: TIEPixelFormat; virtual; abstract;
function GetRowLen: integer; virtual; abstract;
function GetPalette(index: integer): TRGB; virtual; abstract;
procedure SetPalette(index: integer; Value: TRGB); virtual; abstract;
function GetPaletteLen:integer; virtual; abstract;
public
property Scanline[row: integer]: pointer read GetScanline;
property BitCount: integer read GetBitCount;
property Width: integer read GetWidth;
property Height: integer read GetHeight;
property PixelFormat: TIEPixelFormat read GetPixelFormat;
procedure Allocate(ImageWidth, ImageHeight: integer; ImagePixelFormat: TIEPixelFormat); virtual; abstract;
procedure Assign(Source: TObject); virtual; abstract;
property RowLen: integer read GetRowLen;
{!!
<FS>TIEBaseBitmap.Access
<FM>Declaration<FC>
property Access:<A TIEDataAccess>;
<FM>Description<FN>
Access specifies if the bitmap is readable or/and writable. This works only when Location is ieFile to speed up reading and writing operations.
The default value is [iedRead,iedWrite] that means read and write.
<FM>Examples<FC>
// set writeonly when load input.tif (in reality this is automatic!)
ImageEnView.IEBitmap.Access:=[iedWrite];
ImageEnView.IO.LoadFromFile('input.tif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -