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

📄 imagemagickapi.pas

📁 ImageMagick library of image with Visual C++6
💻 PAS
📖 第 1 页 / 共 5 页
字号:
{ ImageMagickAPI unit

  This unit is the Delphi Import unit for the ImageMagick library that can
  be found here:
  http://studio.imagemagick.org/

  -------------------------------------------------------------------------

  Original files: most *.h files in ImageMagic "include\magick" library

  Translated: 29 March 2003
  Translator and Author: Ian Stuart

  Additions:
  22 Apr 2003: Ian Stuart (many additions)
  12 Aug 2003: "GetPixels" by Abbas Tabibi
  02 Sep 2003: "ReplaceImageInList" addition (NH)

  For more info please visit:
  http://www.simdesign.nl/components/imagemagick.html

  NOTES:
  If you wish to dynamic linking then look down below for the first
  instance of the _DYNAMIC_LOAD_MAGICK sysbol and define it. To use this
  header with dynamic linking, you will need to call InitImageMagick
  before calling any other functions. FreeInitMagick should be called
  out of courtesy for every InitImageMagick if you are loading and freeing
  on demand (reference counted). This unit will automatically free
  the ImageMagick dlls when the application exits.

  If you define or undefine _DYNAMIC_LOAD_MAGICK you will have to rebuild any
  components that use this file! To be safe, all units that include
  ImageMagick should call InitImageMagick prior to use (preferrably in
  the "initialization" section. That way the components will still work
  no matter what loading method is used. FreeImageMagick should then be
  called in those unit "finalization" sections.
  -------------------------------------------------------------------------

  The contents of this file are subject to the Mozilla Public
  License Version 1.1 (the "License"); you may not use this file
  except in compliance with the License. You may obtain a copy of
  the License at:
  http://www.mozilla.org/MPL/

  Software distributed under the License is distributed on an
  "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  implied. See the License for the specific language governing
  rights and limitations under the License.

}

unit ImageMagickAPI;


interface
  uses Classes, WinTypes, ImError, ImSemaphore;


// -----------------------------------------------------------------------
//  Define _DYNAMIC_LOAD_MAGICK to dynamically link the CORE_RL_magick_.dll
// -----------------------------------------------------------------------
{$DEFINE _DYNAMIC_LOAD_MAGICK}


const
{$IFDEF _DYNAMIC_LOAD_MAGICK}
  IsDynamicLoad = True; 
{$ELSE}
  IsDynamicLoad = False;
{$ENDIF}

// current windows code dll release does not auto initialize itself.
{$UNDEF _EXTERNAL_AUTO_INIT_MAGICK}

{$IFNDEF _EXTERNAL_AUTO_INIT_MAGICK}

// -----------------------------------------------------------------------
// Define _AUTO_INITIALIZE_MAGICK if you want InitializeMagick and
// DestroyMagick called automatically for you.
// -----------------------------------------------------------------------
{$DEFINE _AUTO_INTIALIZE_MAGICK}

{$ENDIF}

const
{$IFDEF _AUTO_INTIALIZE_MAGICK}
  IsAutoInitialized = True;
{$ELSE}
  IsAutoInitialized = False;
{$ENDIF}


// enums are 4byte values for VisualC++ library build.
{$Z4}

const
  MaxTextExtent = 2053;          // DO NOT CHANGE! This is defined
                                 // in CORE_RL_magick_.dll
  MagickSignature = $ABACADAB;   // DO NOT CHANGE!


// -----------------------------------------------------------------------
// Current windows 5.5.6 Q16 version. The name may change in the future
// as Q8 and Q32 versions become available.
// -----------------------------------------------------------------------
  magick_dll_name = 'CORE_RL_magick_.dll';

// future names:
// magick_dll_name = 'CORE_RL_magick_Q8.dll';
// magick_dll_name = 'CORE_RL_magick_Q16.dll';
// magick_dll_name = 'CORE_RL_magick_Q32.dll';

// -----------------------------------------------------------------------
//  QuantumDepth represents the bits per pixel color. CORE_RL_magick_.dll
//  as released for Windows platform uses Q16. Future releases of this
//  dll for Delphi will hopefully be available in Q8 and Q32.
// -----------------------------------------------------------------------

// {$DEFINE QUANTUMDEPTH8}
//  QuantumDepth = 8;
// {$DEFINE QUANTUMDEPTH32}
//  QuantumDepth = 32;

{$DEFINE QUANTUMDEPTH16}
  QuantumDepth = 16;


{$IFDEF QUANTUMDEPTH8}
  type
    Quantum = Byte;
  const
    MaxColormapSize = 256;
    MaxMap = 255;
    MaxRGB = 255;
{$ENDIF}

{$IFDEF QUANTUMDEPTH16}
  type
    Quantum = Word;
  const
    MaxColormapSize = 65536;
    MaxMap = 65535;
    MaxRGB = 65535;
{$ENDIF}

{$IFDEF QUANTUMDEPTH32}
  type
    Quantum = Cardinal;
  const
    MaxColormapSize = 65536;
    MaxMap = 65535;
    MaxRGB = 4294967295;
{$ENDIF}

const
  OpaqueOpacity = 0;
  TransparentOpacity = MaxRGB;


type
  PCardinal = ^Cardinal;
  PQuantum = ^Quantum;

// -----------------------------------------------------------------------
// Timers
// -----------------------------------------------------------------------
  TImTimerState = (
    imUndefinedTimerState, imStoppedTimerState, imRunningTimerState
  );
  PImrTimer = ^TImrTimer;
  TImrTimer = record
    Start: Double;
    Stop: Double;
    Total: Double;
  end;
  PImrTimerInfo = ^TImrTimerInfo;
  TImrTimerInfo = record
    User: TImrTimer;
    Elapsed: TImrTimer;
    State: TimTimerState;
    Signature: Cardinal;
  end;

// -----------------------------------------------------------------------
// Compression
// -----------------------------------------------------------------------
  PImrAscii85Info = ^TImrAscii85Info;
  TImrAscii85Info = record
    Offset: Integer;
    LineBreak: Integer;
    Buffer: array[0..9] of Byte;
  end;

// -----------------------------------------------------------------------
// Image enums
// -----------------------------------------------------------------------
  TImChannelType = (
    imUndefinedChannel, imRedChannel, imCyanChannel, imGreenChannel,
    imMagentaChannel, imBlueChannel, imYellowChannel, imOpacityChannel,
    imBlackChannel, imMatteChannel
  );
  TImClassType = (
    imUndefinedClass, imDirectClass, imPseudoClass
  );
  TImColorspaceType = (
    imUndefinedColorspace, imRGBColorspace, imGRAYColorspace,
    imTransparentColorspace, imOHTAColorspace, imXYZColorspace,
    imYCbCrColorspace, imYCCColorspace, imYIQColorspace,
    imYPbPrColorspace, imYUVColorspace, imCMYKColorspace,
    imsRGBColorspace
  );

const
    imUndefinedCompliance = $0000;
    imNoCompliance = $0000;
    imSVGCompliance = $0001;
    imX11Compliance = $0002;
    imXPMCompliance = $0004;
    imAllCompliance = $ffff;
type
  TImComplianceType = Cardinal;

  TImCompositeOperator = (
    imUndefinedCompositeOp, imOverCompositeOp, imInCompositeOp,
    imOutCompositeOp, imAtopCompositeOp, imXorCompositeOp,
    imPlusCompositeOp, imMinusCompositeOp, imAddCompositeOp,
    imSubtractCompositeOp, imDifferenceCompositeOp, imMultiplyCompositeOp,
    imBumpmapCompositeOp, imCopyCompositeOp, imCopyRedCompositeOp,
    imCopyGreenCompositeOp, imCopyBlueCompositeOp, imCopyOpacityCompositeOp,
    imClearCompositeOp, imDissolveCompositeOp, imDisplaceCompositeOp,
    imModulateCompositeOp, imThresholdCompositeOp, imNoCompositeOp,
    imDarkenCompositeOp, imLightenCompositeOp, imHueCompositeOp,
    imSaturateCompositeOp, imColorizeCompositeOp, imLuminizeCompositeOp,
    imScreenCompositeOp, imOverlayCompositeOp
  );
  TImCompressionType = (
    imUndefinedCompression, imNoCompression, imBZipCompression,
    imFaxCompression, imGroup4Compression, imJPEGCompression,
    imLosslessJPEGCompression, imLZWCompression, imRLECompression,
    imZipCompression
  );
  TImDisposeType = (
    imUndefinedDispose, imNoneDispose, imBackgroundDispose,
    imPreviousDispose
  );
  TImEndianType = (
    imUndefinedEndian, imLSBEndian, imMSBEndian
  );
  TImFilterType = (
    imUndefinedFilter, imPointFilter, imBoxFilter, imTriangleFilter,
    imHermiteFilter, imHanningFilter, imHammingFilter, imBlackmanFilter,
    imGaussianFilter, imQuadraticFilter, imCubicFilter, imCatromFilter,
    imMitchellFilter, imLanczosFilter, imBesselFilter, imSincFilter
  );

const
    imNoValue = $0000; imPsiValue = $0001; imXValue = $0001;
    imXiValue = $0002; imYValue = $0002; imRhoValue = $0004;
    imWidthValue = $0004; imSigmaValue = $0008; imHeightValue = $0008;
    imAllValues = $000F; imXiNegative = $0010; imXNegative = $0010;
    imPsiNegative = $0020; imYNegative = $0020; imPercentValue = $1000;
    imAspectValue = $2000; imLessValue = $4000; imGreaterValue = $8000;
    imAreaValue = $10000;
type
  TImGeometryFlags = Cardinal;

  TImGravityType = (
    imForgetGravity, imNorthWestGravity, imNorthGravity, imNorthEastGravity,
    imWestGravity, imCenterGravity, imEastGravity, imSouthWestGravity,
    imSouthGravity, imSouthEastGravity, imStaticGravity
  );
  TImImageType = (
    imUndefinedType, imBilevelType, imGrayscaleType, imGrayscaleMatteType,
    imPaletteType, imPaletteMatteType, imTrueColorType, imTrueColorMatteType,
    imColorSeparationType, imColorSeparationMatteType, imOptimizeType
  );
  TImInterlaceType = (
    imUndefinedInterlace, imNoInterlace, imLineInterlace,
    imPlaneInterlace, imPartitionInterlace
  );
  TImMontageMode = (
    imUndefinedMode, imFrameMode, imUnframeMode, imConcatenateMode
  );
  TImNoiseType = (
    imUniformNoise, imGaussianNoise, imMultiplicativeGaussianNoise,
    imImpulseNoise, imLaplacianNoise, imPoissonNoise
  );
  TImProfileType = (
    imUndefinedProfile, imICMProfile, imIPTCProfile
  );
  TImPreviewType = (
    imUndefinedPreview, imRotatePreview, imShearPreview,
    imRollPreview, imHuePreview, imSaturationPreview,
    imBrightnessPreview, imGammaPreview, imSpiffPreview,
    imDullPreview, imGrayscalePreview, imQuantizePreview,
    imDespecklePreview, imReduceNoisePreview, imAddNoisePreview,
    imSharpenPreview, imBlurPreview, imThresholdPreview,
    imEdgeDetectPreview, imSpreadPreview, imSolarizePreview,
    imShadePreview, imRaisePreview, imSegmentPreview,
    imSwirlPreview, imImplodePreview, imWavePreview,
    imOilPaintPreview, imCharcoalDrawingPreview, imJPEGPreview
  );

⌨️ 快捷键说明

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