📄 imagemagickapi.pas
字号:
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function RaiseImage(Image: PImrImage; const raiseInfo: PImrRectangleInfo;
const raiseValue: Integer): LongBool; cdecl;
// blob
procedure AttachBlob(BlobInfo: PImrBlobInfo; const blob: Pointer;
const blobSize: Cardinal); cdecl;
function BlobToImage(const ImageInfo: PImrImageInfo; const blob: Pointer;
const blobSize: Cardinal; eInfo: PImrExceptionInfo): PImrImage; cdecl;
function _ImageToBlob(const ImageInfo: PImrImageInfo; Image: PImrImage;
blobSize: PCardinal; eInfo: PImrExceptionInfo): Pointer; cdecl;
function _BlobToFile(const filename: PChar; const blob: Pointer; const blobSize: Cardinal;
eInfo: PImrExceptionInfo): LongBool; cdecl;
function _FileToBlob(const filename: PChar; blobSize: PCardinal;
eInfo: PImrExceptionInfo): Pointer; cdecl;
function CloneBlobInfo(const BlobInfo: PImrBlobInfo): PImrBlobInfo; cdecl;
procedure DestroyBlobInfo(Blob: PImrBlobInfo); cdecl;
procedure DetachBlob(Blob: PImrBlobInfo); cdecl;
procedure GetBlobInfo(Blob: PImrBlobInfo); cdecl;
function GetBlobStreamData(const Image: PImrImage): PByte; cdecl;
function GetBlobStreamType(const Image: PImrImage): TImStreamType; cdecl;
function _GetConfigureBlob(const filename: PChar; Path: PChar; BlobSize: PCardinal;
eInfo: PImrExceptionInfo): Pointer; cdecl;
function _ImageToFile(Image: PImrImage; const filename: PChar;
eInfo: PImrExceptionInfo): LongBool; cdecl;
function PingBlob(const ImageInfo: PImrImageInfo; const blob: Pointer;
const blobSize: Cardinal; eInfo: PImrExceptionInfo): PImrImage; cdecl;
function ReferenceBlob(BlobInfo: PImrBlobInfo): PImrBlobInfo; cdecl;
function _GetModuleBlob(const filename: PChar; path: PChar; blobSize: PCardinal;
eInfo: PImrExceptionInfo): Pointer; cdecl;
function _GetTypeBlob(const filename: PChar; path: PChar; blobSize: PCardinal;
eInfo: PImrExceptionInfo): Pointer; cdecl;
// memory and utils
function AcquireMemory(const size: Cardinal): Pointer; cdecl;
function AcquireString(const Source: PChar): PChar; cdecl;
function AllocateString(const Source: PChar): PChar; cdecl;
function CloneMemory(destination: Pointer; const source: Pointer;
const size: Cardinal): Pointer; cdecl;
procedure GetPathComponent(const Path: PChar; PathType: TImPathType;
Component: PChar); cdecl;
procedure LiberateMemory(var memory: Pointer); cdecl;
procedure ReacquireMemory(var memory: Pointer; const size: Cardinal); cdecl;
// compression
procedure Ascii85Initialize(Image: PImrImage); cdecl;
procedure Ascii85Flush(Image: PImrImage); cdecl;
procedure Ascii85Encode(Image: PImrImage; const Code: Cardinal); cdecl;
function HuffmanDecodeImage(Image: PImrImage): LongBool; cdecl;
function HuffmanEncodeImage(const ImageInfo: PImrImageInfo; Image: PImrImage): LongBool; cdecl;
function LZWEncodeImage(Image: PImrImage; const Length: Cardinal; PixelData: PByte): LongBool; cdecl;
function PackbitsEncodeImage(Image: PImrImage; const Length: Cardinal; PixelData: PByte): LongBool; cdecl;
// lists
function NewImageList: PImrImage; cdecl; // just returns nil!
function CloneImageList(const Image: PImrImage; E: PImrExceptionInfo): PImrImage; cdecl;
procedure DestroyImageList(Images: PImrImage); cdecl;
function GetImageFromList(const Image: PImrImage; const Index: Integer): PImrImage; cdecl;
function GetNextImageInList(const Image: PImrImage): PImrImage; cdecl;
function GetPreviousImageInList(const Image: PImrImage): PImrImage; cdecl;
procedure AppendImageToList(var Images: PImrImage; Image: PImrImage); cdecl;
procedure DeleteImageFromList(var Images: PImrImage); cdecl;
procedure InsertImageInList(var Images: PImrImage; Image: PImrImage); cdecl;
procedure PrependImageToList(var Images: PImrImage; Image: PImrImage); cdecl;
function RemoveFirstImageFromList(var Images: PImrImage): PImrImage; cdecl;
function RemoveLastImageFromList(Images: PPImrImage): PImrImage; cdecl;
function SplitImageList(Images: PImrImage): PImrImage; cdecl;
procedure ReverseImageList(var Images: PImrImage); cdecl;
function SyncNextImageInList(const Image: PImrImage): PImrImage; cdecl;
procedure SpliceImageIntoList(var Images: PImrImage; const SpliceLength: Cardinal; Image: PImrImage); cdecl;
function GetImageIndexInList(const Image: PImrImage): Integer; cdecl;
function GetImageListLength(const Image: PImrImage): Cardinal; cdecl;
// rendering + type
procedure DestroyTypeInfo; cdecl;
function GetTypeInfo(const Name: PChar; eInfo: PImrExceptionInfo): PImrTypeInfo; cdecl;
function GetTypeInfoByFamily(const Family: PChar;
const Style: TImStyleType; const stretchType: TImStretchType;
const Weight: Cardinal; eInfo: PImrExceptionInfo): PImrTypeInfo; cdecl;
function _GetTypeList(const Pattern: PChar; NumberOfTypes: PCardinal): PPChar; cdecl;
function CloneDrawInfo(const ImageInfo: PImrImageInfo; const DrawInfo: PImrDrawInfo): PImrDrawInfo; cdecl;
procedure DestroyDrawInfo(DrawInfo: PImrDrawInfo); cdecl;
function DrawAffineImage(Image: PImrImage; const Composite: PImrImage;
const Affine: PImrAffineMatrix): LongBool; cdecl;
function DrawClipPath(Image: PImrImage; const DrawInfo: PImrDrawInfo;
const Name: PChar): Cardinal; cdecl;
function DrawImage(Image: PImrImage; const DrawInfo: PImrDrawInfo): LongBool; cdecl;
function DrawPatternPath(Image: PImrImage; const DrawInfo: PImrDrawInfo;
const Name: PChar; var Pattern: PImrImage): LongBool; cdecl;
function DrawPrimitive(Image: PImrImage; const DrawInfo: PImrDrawInfo;
const PrimitiveInfo: PImrPrimitiveInfo): LongBool; cdecl;
procedure GetDrawInfo(const ImageInfo: PImrImageInfo; DrawInfo: PImrDrawInfo); cdecl;
// BEGIN ADDED 22/04/2003 I.Stuart
// annotate
function AnnotateImage(Image: PImrImage; const DrawInfo: PImrDrawInfo): LongBool; cdecl;
function GetTypeMetrics(Image: PImrImage; const DrawInfo: PImrDrawInfo; Metrics: PImrTypeMetric): LongBool; cdecl;
// color
function GetColorInfo(const ColorName: PChar; eInfo: PImrExceptionInfo): PImrColorInfo; cdecl;
function FuzzyColorCompare(const Image: PImrImage; const P1, P2: PImrPixelPacket): LongBool; cdecl;
function IsGrayImage(const Image: PImrImage; eInfo: PImrExceptionInfo): LongBool; cdecl;
function IsMonochromeImage(const Image: PImrImage; eInfo: PImrExceptionInfo): LongBool; cdecl;
function IsOpaqueImage(const Image: PImrImage; eInfo: PImrExceptionInfo): LongBool; cdecl;
function IsPaletteImage(const Image: PImrImage; eInfo: PImrExceptionInfo): LongBool; cdecl;
function QueryColorDatabase(const ColorName: PChar; Color: PImrPixelPacket; eInfo: PImrExceptionInfo): LongBool; cdecl;
function QueryColorName(const Image: PImrImage; const Color: PImrPixelPacket; const Compliance: TImComplianceType;
NameBuffer: PChar; eInfo: PImrExceptionInfo): LongBool; cdecl;
// colorspace
function RGBTransformImage(Image: PImrImage; const colorSpaceType: TImColorSpaceType): LongBool; cdecl;
// profile
function ProfileImage(Image: PImrImage; const ProfileName: PChar; const ProfileData: PByte;
const ProfileSize: Cardinal; CloneProfile: LongBool):LongBool; cdecl;
procedure TransformColorspace(Image: PImrImage; const colorSpaceType: TImColorSpaceType); cdecl;
function TransformRGBImage(Image: PImrImage; const colorSpaceType: TImColorSpaceType): LongBool; cdecl;
// gem
procedure Contrast(const sign: Integer; red, green, blue: PQuantum); cdecl;
function GenerateNoise(const Pixel: Quantum; const NoiseType: TImNoiseType): Quantum; cdecl;
function ExpandAffine(const affine: PImrAffineMatrix): Double; cdecl;
function GetOptimalKernelWidth(const radius, sigma: double): Integer; cdecl;
procedure HSLTransform(const hue, saturation, luminosity: double; Red, Green, Blue: PQuantum); cdecl;
procedure HWBTransform(const hue, whiteness, blackness: double; Red, Green, Blue: PQuantum); cdecl;
procedure Hull(const XOffset, YOffset: Longint; const Columns, Rows: Cardinal;
pixel, neighbour: PQuantum; const polarity: Integer); cdecl;
procedure IdentityAffine(Affine: PImrAffineMatrix); cdecl;
function InterpolateColor(const Image: PImrImage; const XOffset, YOffset: Double; eInfo: PImrExceptionInfo): TImrPixelPacket; cdecl;
procedure Modulate(const percentHue, percentSaturation, percentBrightness: double;
Red, Green, Blue: PQuantum); cdecl;
procedure TransformHSL(const Red, Green, Blue: Quantum; hue, saturation, luminosity: PDouble); cdecl;
procedure TransformHWB(const Red, Green, Blue: Quantum; hue, whiteness, blackness: PDouble); cdecl;
procedure Upsample(const width, height, scaledWidth: Cardinal; pixelData: PByte); cdecl;
// geometry
function GetGeometry(const geometry: PChar; x, y: PInteger; width, height: PCardinal): TImGeometryFlags; cdecl;
function GetPageGeometry(const pageGeometry: PChar): PChar; cdecl;
function IsGeometry(const geometry: PChar): LongBool; cdecl;
function IsSceneGeometry(const geometry: PChar; const pedantic: LongBool): LongBool; cdecl;
function ParseAbsoluteGeometry(const geometry: PChar; regionInfo: PImrRectangleInfo): TImGeometryFlags; cdecl;
function ParseGeometry(const geometry: PChar; info: PImrGeometryInfo): TImGeometryFlags; cdecl;
function ParseGravityGeometry(const Image: PImrImage; const geometry: PChar; regionInfo: PImrRectangleInfo): TImGeometryFlags; cdecl;
function ParseMetaGeometry(const geometry: PChar; x, y: PInteger; width, height: PCardinal): TImGeometryFlags; cdecl;
function ParsePageGeometry(const Image: PImrImage; const geometry: PChar; regionInfo: PImrRectangleInfo): TImGeometryFlags; cdecl;
function ParseSizeGeometry(const Image: PImrImage; const geometry: PChar; regionInfo: PImrRectangleInfo): TImGeometryFlags; cdecl;
procedure SetGeometry(const Image: PImrImage; geometry: PImrRectangleInfo); cdecl;
procedure SetGeometryInfo(geometryInfo: PImrGeometryInfo); cdecl;
// paint
function ColorFloodfillImage(Image: PImrImage; const drawInfo: PImrDrawInfo;
const target: TImrPixelPacket; const XOffset, YOffset: Longint; const paintMethod: TImPaintMethod): LongBool; cdecl;
function MatteFloodfillImage(Image: PImrImage; const target: TImrPixelPacket;
const XOffset, YOffset: Longint; const paintMethod: TImPaintMethod): LongBool; cdecl;
function OpaqueImage(Image: PImrImage; const target, fill: TImrPixelPacket): LongBool; cdecl;
function TransparentImage(Image: PImrImage; const target: TImrPixelPacket; const opacity: Cardinal): LongBool; cdecl;
// quantize
function CloneQuantizeInfo(const quantizeInfo: PImrQuantizeInfo): PImrQuantizeInfo; cdecl;
procedure CompressImageColormap(Image: PImrImage); cdecl;
procedure DestroyQuantizeInfo(quantizeInfo: PImrQuantizeInfo); cdecl;
function GetImageQuantizeError(Image: PImrImage): LongBool; cdecl;
procedure GetQuantizeInfo(quantizeInfo: PImrQuantizeInfo); cdecl;
function MapImage(Image: PImrImage; const Map: PImrImage; const dither: Cardinal): LongBool; cdecl;
function MapImages(Images: PImrImage; const Map: PImrImage; const dither: Cardinal): LongBool; cdecl;
function OrderedDitherImage(Image: PImrImage): LongBool; cdecl;
function QuantizeImage(const quantizeInfo: PImrQuantizeInfo; Image: PImrImage): LongBool; cdecl;
function QuantizeImages(const quantizeInfo: PImrQuantizeInfo; Images: PImrImage): LongBool; cdecl;
//by Tabibi
function ImportImagePixels(const Image: PImrImage; const x_offset, y_offset: LongInt;
const columns, rows: cardinal; const map: PChar;
const PixelsType: TStorageType; pixels: Pointer): LongBool; cdecl;
//end by Tabibi
// shear
function AffineTransformImage(const Image: PImrImage;
const affine: PImrAffineMatrix; eInfo: PImrExceptionInfo): PImrImage; cdecl;
function RotateImage(const Image: PImrImage; const degrees: Double;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function ShearImage(const Image: PImrImage; const XShear, YShear: Double;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
// transform
function ChopImage(const Image: PImrImage; const chopInfo: PImrRectangleInfo;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function CoalesceImages(const Image: PImrImage; eInfo: PImrExceptionInfo): PImrImage; cdecl;
function CropImage(const Image: PImrImage; const geometry: PImrRectangleInfo;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function DeconstructImages(const Image: PImrImage; eInfo: PImrExceptionInfo): PImrImage; cdecl;
function FlattenImages(const Image: PImrImage; eInfo: PImrExceptionInfo): PImrImage; cdecl;
function FlipImage(const Image: PImrImage; eInfo: PImrExceptionInfo): PImrImage; cdecl;
function FlopImage(const Image: PImrImage; eInfo: PImrExceptionInfo): PImrImage; cdecl;
function MosaicImages(const Image: PImrImage; eInfo: PImrExceptionInfo): PImrImage; cdecl;
function RollImage(const Image: PImrImage; const xOffset, YOffset: Integer;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function ShaveImage(const Image: PImrImage; const shaveInfo: PImrRectangleInfo;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
procedure TransformImage(var Image: PImrImage; const cropGeometry, imageGeometry: PChar); cdecl;
// END ADDED 22/04/2003 I.Stuart
function ImageToHBITMAP(Image: PImrImage): HBITMAP; cdecl;
{$ENDIF} // static linking
// --------------------------------------------------------------------------
// Dynamic linking - call InitImageMagick to load the library and make
// sure you call FreeImageMagick the same number of times!
// --------------------------------------------------------------------------
{$IFDEF _DYNAMIC_LOAD_MAGICK}
var
_InitializeMagick: procedure(const path: PChar); cdecl;
_DestroyMagick: procedure; cdecl;
DestroyMagickInfo: procedure; cdecl;
_MagickToMime: function(const Magick: PChar): PChar; cdecl;
GetMagickInfo: function(const Name: PChar; eInfo: PImrExceptionInfo): PImrMagickInfo; cdecl;
RegisterMagickInfo: function(MagickInfo: PImrMagickInfo): PImrMagickInfo; cdecl;
SetMagickInfo: function(const Name: PChar): PImrMagickInfo; cdecl;
DestroyExceptionInfo: procedure(E: PImrExceptionInfo); cdecl;
GetExceptionInfo: procedure(E: PImrExceptionInfo); cdecl;
CatchException: procedure(const E: PImrExceptionInfo); cdecl;
MagickError: procedure(const ExceptionType: TImExceptionType; const reason, description: PChar); cdecl;
MagickWarning: procedure(const ExceptionType: TImExceptionType; const reason, description: PChar); cdecl;
SetErrorHandler: function(ErrorHandler: TImErrorHandler): TImErrorHandler; cdecl;
SetWarningHandler: function(ErrorHandler: TImErrorHandler): TImErrorHandler; cdecl;
SetFatalErrorHandler: function(ErrorHandler: TImErrorHandler): TImErrorHandler; cdecl;
ThrowException: procedure(E: PImrExceptionInfo; const exceptionType: TImExceptionType; const reason, description: PChar); cdecl;
SetExceptionInfo: procedure(E: PImrExceptionInfo; severity: TImExceptionType); cdecl;
_GetLocaleExceptionMessage: function(const severity: TImExceptionType; const MessageTag: PChar): PChar; cdecl;
AllocateImage: function(const Info: PImrImageInfo): PImrImage; cdecl;
AllocateImageColormap: function(Image: PImrImage; const ColorCount: Cardinal): LongBool; cdecl;
AllocateNextImage: procedure(const Info: PImrImageInfo; Image: PImrImage); cdecl;
AppendImages: function(const Image: PImrImage; const Vertical: LongBool; eInfo: PImrExceptionInfo): PImrImage; cdecl;
CatchImageException: function(Image: PImrImage): TImExceptionType; cdecl;
ChannelImage: function(Image: PImrImage; const channelType: TImChannelType): LongBool; cdecl;
ClipImage: function(Image: PImrImage): LongBool; cdecl;
CloneImage: function(const Image: PImrImage; const width, height: Cardinal; const Orphan: LongBool; eInfo: PImrExceptionInfo): PImrImage; cdecl;
CloneImageInfo: function(const Info: PImrImageInfo): PImrImageInfo; cdecl;
ConstituteImage: function(const width, height: Cardinal; const Map: PChar;
const storageType: TImStorageType; const Pixels: Pointer;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
CycleColormapImage: procedure(Image: PImrImage; const amount: Integer); cdecl;
DestroyConstitute: procedure; cdecl;
DestroyImage: procedure(Image: PImrImage); cdecl;
DestroyImageInfo: procedure(Info: PImrImageInfo); cdecl;
DispatchImage: function(const Image: PImrImage; const xOffset, yOffset: Integer;
const width, height: Cardinal; const Map: Pchar; const storageType: TImStorageType;
Pixels: Pointer; eInfo: PImrExceptionInfo): LongBool; cdecl;
GetImageAttribute: function(const Image: PImrImage; const Key: PChar): PImrImageAttribute; cdecl;
GetImageClippingPathAttribute: function(const Image: PImrImage): PImrImageAttribute; cdecl;
GetImageDepth: function(const Image: PImrImage; eInfo: PImrExceptionInfo): Cardinal; cdecl;
GetImageException: procedure(Image: PImrImage; eInfo: PImrExceptionInfo); cdecl;
GetImageInfo: procedure(Info: PImrImageInfo); cdecl;
GetImageType: function(const Image: PImrImage; eInfo: PImrExceptionInfo): TImImageType; cdecl;
IsImagesEqual: function(Image: PImrImage; const Reference: PImrImage): LongBool; cdecl;
IsTaintImage: function(const Image: PImrImage): LongBool; cdecl;
ModifyImage: procedure(Image: PImrImage; eInfo: PImrExceptionInfo); cdecl;
PingImage: function(const Image: PImrImageInfo; eInfo: PImrExceptionInfo): PImrImage; cdecl;
PlasmaImage: function(Image: PImrImage; const segmentInfo: PImrSegmentInfo;
attenuate, depth: Cardinal): LongBool; cdecl;
PopImagePixels: function(const Image: PImrImage; const QuantumType: TImQuantumType; Destination: PByte): LongBool; cdecl;
PushImagePixels: function(const Image: PImrImage; const QuantumType: TImQuantumType; const Source: PByte): LongBool; cdecl;
ReadImage: function(const Info: PImrImageInfo; eInfo: PImrExceptionInfo): PImrImage; cdecl;
ReadInlineImage: function(const Info: PImrImageInfo; const Content: PChar; eInfo: PImrExceptionInfo): PImrImage; cdecl;
ReplaceImageInList: procedure(var Images: PImrImage; Image : PImrImage); cdecl;
ReferenceImage: function(Image: PImrImage): PImrImage; cdecl;
SetImage: procedure(Image: PImrImage; const opacity: Quantum); cdecl;
SetImageAttribute: function(Image: PImrImage; const Key, Value: PChar): LongBool; cdecl;
SetImageClipMask: function(Image, ClipMask: PImrImage): LongBool; cdecl;
SetImageDepth: function(Image: PImrImage; const depth: Cardinal): LongBool; cdecl;
SetImageOpacity: procedure(Image: PImrImage; const Opacity: Cardinal); cdecl;
SetImageType: procedure(Image: PImrImage; const ImageType: TImImageType); cdecl;
TextureImage: procedure(Image: PImrImage; const texture: PImrImage); cdecl;
WriteImage: function(const Info: PImrImageInfo; Image: PImrImage): Cardinal; cdecl;
WriteImages: function(const Info: PImrImageInfo; Image: PImrImage;
const Filename: PChar; eInfo: PImrExceptionInfo): LongBool; cdecl;
MagnifyImage: function(const Image: PImrImage; eInfo: PImrExceptionInfo): PImrImage; cdecl;
MinifyImage: function(const Image: PImrImage; eInfo: PImrExceptionInfo): PImrImage; cdecl;
ResizeImage: function(const Image: PImrImage; const Width, Height: Cardinal;
const FilterType: TImFilterType; const blur: Double; eInfo: PImrExceptionInfo): PImrImage; cdecl;
SampleImage: function(const Image: PImrImage; const Width, Height: Cardinal; eInfo: PImrExceptionInfo): PImrImage; cdecl;
ScaleImage: function(const Image: PImrImage; const Width, Height: Cardinal; eInfo: PImrExceptionInfo): PImrImage; cdecl;
ThumbnailImage: function(const Image: PImrImage; const Width, Height: Cardinal;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
AdaptiveThresholdImage: function(const Image : PImrImage; const width, height: Cardinal; const offset: Integer;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -