📄 imagemagickapi.pas
字号:
ElementReference: TImrElementReference;
Signature: Cardinal;
end;
TImrElementInfo = record
cx: Double;
cy: Double;
Major: Double;
Minor: Double;
Angle: Double;
end;
TImrPointInfo = record
x: Double;
y: Double;
end;
PImrPrimitiveInfo = ^TImrPrimitiveInfo;
TImrPrimitiveInfo = record
Point: TImrPointInfo;
Coordinates: Cardinal;
PrimitiveType: TImPrimitiveType;
PaintMethod: TImPaintMethod;
Text: PChar;
end;
PImrTypeInfo = ^TImrTypeInfo;
TImrTypeInfo = record
Path: PChar;
Name: PChar;
Description: PChar;
Family: PChar;
StyleType: TImStyleType;
StetchType: TImStretchType;
Weight: Cardinal;
Encoding: PChar;
Foundry: PChar;
Format: PChar;
Metrics: PChar;
Glyphs: PChar;
Stealth: LongBool;
Signature: Cardinal;
Previous: PImrTypeInfo;
Next: PImrTypeInfo;
end;
PImrTypeMetric = ^TImrTypeMetric;
TImrTypeMetric = record
PixelsPerEM: TImrPointInfo;
Ascent: Double;
Descent: Double;
Width: Double;
Height: Double;
MaxAdvance: Double;
Bounds: TImrSegmentInfo;
UnderlinePosition: Double;
UnderlineThickness: Double;
end;
PImrQuantizeInfo = ^TImrQuantizeInfo;
TImrQuantizeInfo = record
NumColors: Cardinal;
TreeDepth: Cardinal;
Dither: Cardinal;
ColorSpace: TImColorSpaceType;
MeasureError: Cardinal;
Signarure: Cardinal;
end;
PPChar = ^PChar;
// InitImageMagick always returns true if static linking - does nothing else.
function InitImageMagick(const path: string = ''): Boolean;
// FreeImageMagick does nothing for static linking. Otherwise it decrements a ref
// count and eventually unloads the magick_dll. Returns true if library is finally
// unloaded.
function FreeImageMagick: Boolean;
// library intialization. Second version allows PChar but not nil so
// for those that use PChar nil, I have overloaded these.
procedure InitializeMagick(const path: PChar); overload;
procedure InitializeMagick(const path: string); overload;
procedure DestroyMagick;
function HasGhostScript: Boolean;
// friendlier functions
function MagickToMime(const Magick: string): string;
function BlobToFile(const filename: string; const blob: Pointer;
const blobSize: Cardinal; eInfo: PImrExceptionInfo): LongBool;
function FileToBlob(const filename: string; var blobSize: Cardinal;
eInfo: PImrExceptionInfo): Pointer;
function GetConfigureBlob(const filename: string; var Path: string;
var blobSize: Cardinal; eInfo: PImrExceptionInfo): Pointer;
function GetModuleBlob(const filename: string; var Path: string;
var blobSize: Cardinal; eInfo: PImrExceptionInfo): Pointer;
function GetTypeBlob(const filename: string; var Path: string;
var blobSize: Cardinal; eInfo: PImrExceptionInfo): Pointer;
function ImageToBlob(const ImageInfo: PImrImageInfo; Image: PImrImage;
var blobSize: Cardinal; eInfo: PImrExceptionInfo): Pointer;
function ImageToFile(Image: PImrImage; const filename: string;
eInfo: PImrExceptionInfo): LongBool;
function GetLocaleExceptionMessage(const severity: TImExceptionType;
const MessageTag: PChar): string;
function StreamToImage(stream: TStream; const ImageInfo: PImrImageInfo;
const Size: Cardinal; eInfo: PImrExceptionInfo): PImrImage;
function ImageToStream(stream: TStream; const ImageInfo: PImrImageInfo;
Image: PImrImage; eInfo: PImrExceptionInfo): Cardinal;
{$IFNDEF _DYNAMIC_LOAD_MAGICK}
procedure _InitializeMagick(const path: PChar); cdecl;
procedure _DestroyMagick; cdecl;
procedure DestroyMagickInfo; cdecl;
function RegisterMagickInfo(MagickInfo: PImrMagickInfo): PImrMagickInfo; cdecl;
function SetMagickInfo(const Name: PChar): PImrMagickInfo; cdecl;
function _MagickToMime(const Magick: PChar): PChar; cdecl;
function GetMagickInfo(const Name: PChar;
eInfo: PImrExceptionInfo): PImrMagickInfo; cdecl;
procedure DestroyExceptionInfo(E: PImrExceptionInfo); cdecl;
procedure GetExceptionInfo(E: PImrExceptionInfo); cdecl;
procedure CatchException(const E: PImrExceptionInfo); cdecl;
procedure MagickError(const ExceptionType: TImExceptionType;
const reason, description: PChar); cdecl;
procedure MagickWarning(const ExceptionType: TImExceptionType;
const reason, description: PChar); cdecl;
function SetErrorHandler(ErrorHandler: TImErrorHandler): TImErrorHandler; cdecl;
function SetWarningHandler(ErrorHandler: TImErrorHandler): TImErrorHandler; cdecl;
function SetFatalErrorHandler(ErrorHandler: TImErrorHandler): TImErrorHandler; cdecl;
procedure ThrowException(E: PImrExceptionInfo;
const exceptionType: TImExceptionType; const reason, description: PChar); cdecl;
procedure SetExceptionInfo(E: PImrExceptionInfo; severity: TImExceptionType); cdecl;
function _GetLocaleExceptionMessage(const severity: TImExceptionType;
const MessageTag: PChar): PChar; cdecl;
function AllocateImage(const Info: PImrImageInfo): PImrImage; cdecl;
function AllocateImageColormap(Image: PImrImage;
const ColorCount: Cardinal): LongBool; cdecl;
procedure AllocateNextImage(const Info: PImrImageInfo; Image: PImrImage); cdecl;
function AppendImages(const Image: PImrImage; const Vertical: LongBool;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function CatchImageException(Image: PImrImage): TImExceptionType; cdecl;
function ChannelImage(Image: PImrImage;
const channelType: TImChannelType): LongBool; cdecl;
function ClipImage(Image: PImrImage): LongBool; cdecl;
function CloneImage(const Image: PImrImage; const width, height: Cardinal;
const Orphan: LongBool; eInfo: PImrExceptionInfo): PImrImage; cdecl;
function CloneImageInfo(const Info: PImrImageInfo): PImrImageInfo; cdecl;
function ConstituteImage(const width, height: Cardinal; const Map: PChar;
const storageType: TImStorageType; const Pixels: Pointer;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
procedure CycleColormapImage(Image: PImrImage; const amount: Integer); cdecl;
procedure DestroyConstitute; cdecl;
procedure DestroyImage(Image: PImrImage); cdecl;
procedure DestroyImageInfo(Info: PImrImageInfo); cdecl;
function DispatchImage(const Image: PImrImage; const xOffset, yOffset: Integer;
const width, height: Cardinal; const Map: Pchar;
const storageType: TImStorageType; Pixels: Pointer;
eInfo: PImrExceptionInfo): LongBool; cdecl;
function GetImageAttribute(const Image: PImrImage;
const Key: PChar): PImrImageAttribute; cdecl;
function GetImageClippingPathAttribute(
const Image: PImrImage): PImrImageAttribute; cdecl;
function GetImageDepth(const Image: PImrImage;
eInfo: PImrExceptionInfo): Cardinal; cdecl;
procedure GetImageException(Image: PImrImage; eInfo: PImrExceptionInfo); cdecl;
procedure GetImageInfo(Info: PImrImageInfo); cdecl;
function GetImageType(const Image: PImrImage;
eInfo: PImrExceptionInfo): TImImageType; cdecl;
function IsImagesEqual(Image: PImrImage;
const Reference: PImrImage): LongBool; cdecl;
function IsTaintImage(const Image: PImrImage): LongBool; cdecl;
procedure ModifyImage(Image: PImrImage; eInfo: PImrExceptionInfo); cdecl;
function PingImage(const Image: PImrImageInfo;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function PlasmaImage(Image: PImrImage; const segmentInfo: PImrSegmentInfo;
attenuate, depth: Cardinal): LongBool; cdecl;
function PopImagePixels(const Image: PImrImage;
const QuantumType: TImQuantumType; Destination: PByte): LongBool; cdecl;
function PushImagePixels(const Image: PImrImage;
const QuantumType: TImQuantumType; const Source: PByte): LongBool; cdecl;
function ReadImage(const Info: PImrImageInfo;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function ReadInlineImage(const Info: PImrImageInfo; const Content: PChar;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
procedure ReplaceImageInList(var Images: PImrImage; Image : PImrImage); cdecl;
function ReferenceImage(Image: PImrImage): PImrImage; cdecl;
procedure SetImage(Image: PImrImage; const opacity: Quantum); cdecl;
function SetImageAttribute(Image: PImrImage;
const Key, Value: PChar): LongBool; cdecl;
function SetImageClipMask(Image, ClipMask: PImrImage): LongBool; cdecl;
function SetImageDepth(Image: PImrImage; const depth: Cardinal): LongBool; cdecl;
procedure SetImageOpacity(Image: PImrImage; const Opacity: Cardinal); cdecl;
procedure SetImageType(Image: PImrImage; const ImageType: TImImageType); cdecl;
procedure TextureImage(Image: PImrImage; const texture: PImrImage); cdecl;
function WriteImage(const Info: PImrImageInfo;
Image: PImrImage): Cardinal; cdecl;
function WriteImages(const Info: PImrImageInfo; Image: PImrImage;
const Filename: PChar; eInfo: PImrExceptionInfo): LongBool; cdecl;
// sizing and scaling
function MagnifyImage(const Image: PImrImage;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function MinifyImage(const Image: PImrImage;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function ResizeImage(const Image: PImrImage; const Width, Height: Cardinal;
const FilterType: TImFilterType; const blur: Double;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function SampleImage(const Image: PImrImage; const Width, Height: Cardinal;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function ScaleImage(const Image: PImrImage; const Width, Height: Cardinal;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function ThumbnailImage(const Image: PImrImage; const Width, Height: Cardinal;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
// effects
function AdaptiveThresholdImage(const Image : PImrImage;
const width, height: Cardinal; const offset: Integer;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function AddNoiseImage(const Image: PImrImage; const NoiseType: TImNoiseType;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function AverageImages(const Image: PImrImage;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function BlurImage(const Image: PImrImage; const radius, sigma: Double;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function DespeckleImage(const Image: PImrImage;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function EdgeImage(const Image: PImrImage; const radius: double;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function EmbossImage(const Image: PImrImage; const radius, sigma: Double;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function EnhanceImage(const Image: PImrImage;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function GaussianBlurImage(const Image: PImrImage; const radius, sigma: Double;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function MedianFilterImage(const Image: PImrImage; const radius: Double;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function MotionBlurImage(const Image: PImrImage;
const radius, sigma, angle: Double;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function ReduceNoiseImage(const Image: PImrImage; const radius: Double;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function ShadeImage(const Image: PImrImage; const gray: LongBool;
azimuth, elevation: Double): PImrImage; cdecl;
function SharpenImage(const Image: PImrImage; const radius, sigma: Double;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function SpreadImage(const Image: PImrImage; const radius: Cardinal;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function ThresholdImage(Image: PImrImage; const threshold: Double): LongBool; cdecl;
function ThresholdImageChannel(Image: PImrImage;
const threshold: PChar): LongBool; cdecl;
function UnsharpMaskImage(const Image: PImrImage;
const radius, sigma, amount, threshold: Double;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
// enhance
function ContrastImage(Image: PImrImage; const sharpen: Cardinal): LongBool; cdecl;
function EqualizeImage(Image: PImrImage): LongBool; cdecl;
function GammaImage(Image: PImrImage; const level: PChar): LongBool; cdecl;
function LevelImage(Image: PImrImage; const levels: PChar): LongBool; cdecl;
function LevelImageChannel(Image: PImrImage; const channelType: TImChannelType;
const blackPoint, whitePoint, gamma: Double): LongBool; cdecl;
function ModulateImage(Image: PImrImage; const modulate: PChar): LongBool; cdecl;
function NegateImage(Image: PImrImage; const grayScale: Cardinal): LongBool; cdecl;
function NormalizeImage(Image: PImrImage): LongBool; cdecl;
// special effects
function CharcoalImage(const Image: PImrImage; const radius, sigma: Double;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function ColorizeImage(const Image: PImrImage; const opacity: PChar;
const target: TImrPixelPacket; eInfo: PImrExceptionInfo): PImrImage; cdecl;
function ConvolveImage(const Image: PImrImage; const order: Cardinal;
const kernel: PDouble; eInfo: PImrExceptionInfo): PImrImage; cdecl;
function ImplodeImage(const Image: PImrImage; const amount: Double;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function MorphImages(const Image: PImrImage; const frameCount: Cardinal;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function OilPaintImage(const Image: PImrImage; const radius: Double;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
procedure SolarizeImage(Image: PImrImage; const threshold: Double); cdecl;
function SteganoImage(const Image, Watermark: PImrImage;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function StereoImage(const Image, OffsetImage: PImrImage;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function SwirlImage(const Image: PImrImage; degrees: Double;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function WaveImage(const Image: PImrImage; const amplitude, waveLength: Double;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
// decorations - frames
function BorderImage(const Image: PImrImage; const borderInfo: PImrRectangleInfo;
eInfo: PImrExceptionInfo): PImrImage; cdecl;
function FrameImage(const Image: PImrImage; const frameInfo: PImrFrameInfo;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -