github.com/kaydxh/golang@v0.0.131/pkg/gocv/cgo/third_path/graphics-magick/include/GraphicsMagick/magick/image.h (about)

     1  /*
     2    Copyright (C) 2003 - 2019 GraphicsMagick Group
     3    Copyright (C) 2002 ImageMagick Studio
     4    Copyright 1991-1999 E. I. du Pont de Nemours and Company
     5  
     6    This program is covered by multiple licenses, which are described in
     7    Copyright.txt. You should have received a copy of Copyright.txt with this
     8    package; otherwise see http://www.graphicsmagick.org/www/Copyright.html.
     9  
    10    GraphicsMagick Image Methods.
    11  */
    12  #ifndef _MAGICK_IMAGE_H
    13  #define _MAGICK_IMAGE_H
    14  
    15  #if defined(__cplusplus) || defined(c_plusplus)
    16  extern "C" {
    17  #endif
    18  
    19  /*
    20    Include declarations.
    21  */
    22  #include "magick/forward.h"
    23  #include "magick/colorspace.h"
    24  #include "magick/error.h"
    25  #include "magick/timer.h"
    26  
    27  /*
    28    Define declarations.
    29  */
    30  #if !defined(QuantumDepth)
    31  #  define QuantumDepth  16
    32  #endif
    33  
    34  /*
    35    Maximum unsigned RGB value which fits in the specified bits
    36  
    37    If bits <= 0, then zero is returned.  If bits exceeds bits in unsigned long,
    38    then max value of unsigned long is returned.
    39  */
    40  #define MaxValueGivenBits(bits) ((unsigned long) \
    41                                   (((int) bits <= 0) ? 0 :               \
    42                                     ((0x01UL << (Min(sizeof(unsigned long)*8U,(size_t)bits)-1)) + \
    43                                      ((0x01UL << (Min(sizeof(unsigned long)*8U,(size_t)bits)-1))-1))))
    44  
    45  #if (QuantumDepth == 8)
    46  #  define MaxColormapSize  256U
    47  #  define MaxMap  255U
    48  #  define MaxMapDepth 8
    49  #  define MaxMapFloat 255.0f
    50  #  define MaxMapDouble 255.0
    51  #  define MaxRGB  255U
    52  #  define MaxRGBFloat 255.0f
    53  #  define MaxRGBDouble 255.0
    54  #  define ScaleCharToMap(value)        ((unsigned char) (value))
    55  #  define ScaleCharToQuantum(value)    ((Quantum) (value))
    56  #  define ScaleLongToQuantum(value)    ((Quantum) ((value)/16843009UL))
    57  #  define ScaleMapToChar(value)        ((unsigned int) (value))
    58  #  define ScaleMapToQuantum(value)     ((Quantum) (value))
    59  #  define ScaleQuantum(quantum)        ((unsigned long) (quantum))
    60  #  define ScaleQuantumToChar(quantum)  ((unsigned char) (quantum))
    61  #  define ScaleQuantumToLong(quantum)  ((unsigned long) (16843009UL*(quantum)))
    62  #  define ScaleQuantumToMap(quantum)   ((unsigned char) (quantum))
    63  #  define ScaleQuantumToShort(quantum) ((unsigned short) (257U*(quantum)))
    64  #  define ScaleShortToQuantum(value)   ((Quantum) ((value)/257U))
    65  #  define ScaleToQuantum(value)        ((unsigned long) (value))
    66  #  define ScaleQuantumToIndex(value)   ((unsigned char) (value))
    67     typedef unsigned char Quantum;
    68  #elif (QuantumDepth == 16)
    69  #  define MaxColormapSize  65536U
    70  #  define MaxMap 65535U
    71  #  define MaxMapDepth 16
    72  #  define MaxMapFloat 65535.0f
    73  #  define MaxMapDouble 65535.0
    74  #  define MaxRGB  65535U
    75  #  define MaxRGBFloat 65535.0f
    76  #  define MaxRGBDouble 65535.0
    77  #  define ScaleCharToMap(value)        ((unsigned short) (257U*(value)))
    78  #  define ScaleCharToQuantum(value)    ((Quantum) (257U*(value)))
    79  #  define ScaleLongToQuantum(value)    ((Quantum) ((value)/65537UL))
    80  #  define ScaleMapToChar(value)        ((unsigned int) ((value)/257U))
    81  #  define ScaleMapToQuantum(value)     ((Quantum) (value))
    82  #  define ScaleQuantum(quantum)        ((unsigned long) ((quantum)/257UL))
    83  #  define ScaleQuantumToChar(quantum)  ((unsigned char) ((quantum)/257U))
    84  #  define ScaleQuantumToLong(quantum)  ((unsigned long) (65537UL*(quantum)))
    85  #  define ScaleQuantumToMap(quantum)   ((unsigned short) (quantum))
    86  #  define ScaleQuantumToShort(quantum) ((unsigned short) (quantum))
    87  #  define ScaleShortToQuantum(value)   ((Quantum) (value))
    88  #  define ScaleToQuantum(value)        ((unsigned long) (257UL*(value)))
    89  #  define ScaleQuantumToIndex(value)   ((unsigned short) (value))
    90     typedef unsigned short Quantum;
    91  #elif (QuantumDepth == 32)
    92  #  define MaxColormapSize  65536U
    93  #  define MaxRGB  4294967295U
    94  #  define MaxRGBFloat 4294967295.0f
    95  #  define MaxRGBDouble 4294967295.0
    96  #  define ScaleCharToQuantum(value)    ((Quantum) (16843009U*(value)))
    97  #  define ScaleLongToQuantum(value)    ((Quantum) ((value)))
    98  #  define ScaleQuantum(quantum)        ((unsigned long) ((quantum)/16843009UL))
    99  #  define ScaleQuantumToChar(quantum)  ((unsigned char) ((quantum)/16843009U))
   100  #  define ScaleQuantumToLong(quantum)  ((unsigned long) (quantum))
   101  #  define ScaleQuantumToShort(quantum) ((unsigned short) ((quantum)/65537U))
   102  #  define ScaleShortToQuantum(value)   ((Quantum) (65537U*(value)))
   103  #  define ScaleToQuantum(value)        ((unsigned long) (16843009UL*(value)))
   104  #  define ScaleQuantumToIndex(value)   ((unsigned short) ((value)/65537U))
   105  
   106  /*
   107    MaxMap defines the maximum index value for algorithms which depend
   108    on lookup tables (e.g. colorspace transformations and
   109    normalization). When MaxMap is less than MaxRGB it is necessary to
   110    downscale samples to fit the range of MaxMap. The number of bits
   111    which are effectively preserved depends on the size of MaxMap.
   112    MaxMap should be a multiple of 255 and no larger than MaxRGB.  Note
   113    that tables can become quite large and as the tables grow larger it
   114    may take more time to compute the table than to process the image.
   115  */
   116  #define MaxMap 65535U
   117  #define MaxMapDepth 16
   118  #define MaxMapFloat 65535.0f
   119  #define MaxMapDouble 65535.0
   120  #if MaxMap == 65535U
   121  #  define ScaleCharToMap(value)        ((unsigned short) (257U*(value)))
   122  #  define ScaleMapToChar(value)        ((unsigned int) ((value)/257U))
   123  #  define ScaleMapToQuantum(value)     ((Quantum) (65537U*(value)))
   124  #  define ScaleQuantumToMap(quantum)   ((unsigned short) ((quantum)/65537U))
   125  #else
   126  #  define ScaleCharToMap(value)        ((unsigned short) ((MaxMap/255U)*(value)))
   127  #  define ScaleMapToChar(value)        ((unsigned int) ((value)/(MaxMap/255U)))
   128  #  define ScaleMapToQuantum(value)     ((Quantum) ((MaxRGB/MaxMap)*(value)))
   129  #  define ScaleQuantumToMap(quantum)   ((unsigned short) ((quantum)/(MaxRGB/MaxMap)))
   130  #endif
   131  typedef unsigned int Quantum;
   132  #else
   133  #  error "Specified value of QuantumDepth is not supported"
   134  #endif
   135  
   136  #define OpaqueOpacity  0UL
   137  #define TransparentOpacity  MaxRGB
   138  #define RoundDoubleToQuantum(value) ((Quantum) (value < 0.0 ? 0U : \
   139    (value > MaxRGBDouble) ? MaxRGB : value + 0.5))
   140  #define RoundFloatToQuantum(value) ((Quantum) (value < 0.0f ? 0U : \
   141    (value > MaxRGBFloat) ? MaxRGB : value + 0.5f))
   142  #define ConstrainToRange(min,max,value) (value < min ? min :    \
   143    (value > max) ? max : value)
   144  #define ConstrainToQuantum(value) ConstrainToRange(0,MaxRGB,value)
   145  #define ScaleAnyToQuantum(x,max_value) \
   146    ((Quantum) (((double) MaxRGBDouble*x)/max_value+0.5))
   147  #define MagickBoolToString(value) (value != MagickFalse ? "True" : "False")
   148  
   149  /*
   150    Return MagickTrue if channel is enabled in channels.  Allows using
   151    code to adapt if ChannelType enumeration is changed to bit masks.
   152  */
   153  #define MagickChannelEnabled(channels,channel) ((channels == AllChannels) || (channels == channel))
   154  
   155  /*
   156    Deprecated defines.
   157  */
   158  #define RunlengthEncodedCompression RLECompression
   159  #define RoundSignedToQuantum(value) RoundDoubleToQuantum(value)
   160  #define RoundToQuantum(value) RoundDoubleToQuantum(value)
   161  
   162  /*
   163    Enum declarations.
   164  */
   165  typedef enum
   166  {
   167    UnspecifiedAlpha,
   168    AssociatedAlpha,
   169    UnassociatedAlpha
   170  } AlphaType;
   171  
   172  typedef enum
   173  {
   174    UndefinedChannel,
   175    RedChannel,     /* RGB Red channel */
   176    CyanChannel,    /* CMYK Cyan channel */
   177    GreenChannel,   /* RGB Green channel */
   178    MagentaChannel, /* CMYK Magenta channel */
   179    BlueChannel,    /* RGB Blue channel */
   180    YellowChannel,  /* CMYK Yellow channel */
   181    OpacityChannel, /* Opacity channel */
   182    BlackChannel,   /* CMYK Black (K) channel */
   183    MatteChannel,   /* Same as Opacity channel (deprecated) */
   184    AllChannels,    /* Color channels */
   185    GrayChannel     /* Color channels represent an intensity. */
   186  } ChannelType;
   187  
   188  typedef enum
   189  {
   190    UndefinedClass,
   191    DirectClass,
   192    PseudoClass
   193  } ClassType;
   194  
   195  typedef enum
   196  {
   197    UndefinedCompositeOp = 0,
   198    OverCompositeOp,
   199    InCompositeOp,
   200    OutCompositeOp,
   201    AtopCompositeOp,
   202    XorCompositeOp,
   203    PlusCompositeOp,
   204    MinusCompositeOp,
   205    AddCompositeOp,
   206    SubtractCompositeOp,
   207    DifferenceCompositeOp,
   208    MultiplyCompositeOp,
   209    BumpmapCompositeOp,
   210    CopyCompositeOp,
   211    CopyRedCompositeOp,
   212    CopyGreenCompositeOp,
   213    CopyBlueCompositeOp,
   214    CopyOpacityCompositeOp,
   215    ClearCompositeOp,
   216    DissolveCompositeOp,
   217    DisplaceCompositeOp,
   218    ModulateCompositeOp,
   219    ThresholdCompositeOp,
   220    NoCompositeOp,
   221    DarkenCompositeOp,
   222    LightenCompositeOp,
   223    HueCompositeOp,
   224    SaturateCompositeOp,
   225    ColorizeCompositeOp,
   226    LuminizeCompositeOp,
   227    ScreenCompositeOp,
   228    OverlayCompositeOp,
   229    CopyCyanCompositeOp,
   230    CopyMagentaCompositeOp,
   231    CopyYellowCompositeOp,
   232    CopyBlackCompositeOp,
   233    DivideCompositeOp,
   234    HardLightCompositeOp,
   235    ExclusionCompositeOp,
   236    ColorDodgeCompositeOp,
   237    ColorBurnCompositeOp,
   238    SoftLightCompositeOp,
   239    LinearBurnCompositeOp,
   240    LinearDodgeCompositeOp,
   241    LinearLightCompositeOp,
   242    VividLightCompositeOp,
   243    PinLightCompositeOp,
   244    HardMixCompositeOp
   245  } CompositeOperator;
   246  
   247  typedef enum
   248  {
   249    UndefinedCompression,
   250    NoCompression,
   251    BZipCompression,
   252    FaxCompression,
   253    Group3Compression = FaxCompression,
   254    Group4Compression,
   255    JPEGCompression,
   256    LosslessJPEGCompression,
   257    LZWCompression,
   258    RLECompression,
   259    ZipCompression,
   260    LZMACompression,              /* Lempel-Ziv-Markov chain algorithm */
   261    JPEG2000Compression,          /* ISO/IEC std 15444-1 */
   262    JBIG1Compression,             /* ISO/IEC std 11544 / ITU-T rec T.82 */
   263    JBIG2Compression,             /* ISO/IEC std 14492 / ITU-T rec T.88 */
   264    ZSTDCompression,              /* Facebook's Zstandard compression */
   265    WebPCompression               /* Google's WebP compression */
   266  } CompressionType;
   267  
   268  typedef enum
   269  {
   270    UndefinedDispose,
   271    NoneDispose,
   272    BackgroundDispose,
   273    PreviousDispose
   274  } DisposeType;
   275  
   276  typedef enum
   277  {
   278    UndefinedEndian,
   279    LSBEndian,            /* "little" endian */
   280    MSBEndian,            /* "big" endian */
   281    NativeEndian          /* native endian */
   282  } EndianType;
   283  
   284  typedef enum
   285  {
   286    UndefinedFilter,
   287    PointFilter,
   288    BoxFilter,
   289    TriangleFilter,
   290    HermiteFilter,
   291    HanningFilter,
   292    HammingFilter,
   293    BlackmanFilter,
   294    GaussianFilter,
   295    QuadraticFilter,
   296    CubicFilter,
   297    CatromFilter,
   298    MitchellFilter,
   299    LanczosFilter,
   300    BesselFilter,
   301    SincFilter
   302  } FilterTypes;
   303  
   304  typedef enum
   305  {
   306  #undef NoValue
   307    NoValue      = 0x00000,
   308  #undef XValue
   309    XValue       = 0x00001,
   310  #undef YValue
   311    YValue       = 0x00002,
   312  #undef WidthValue
   313    WidthValue   = 0x00004,
   314  #undef HeightValue
   315    HeightValue  = 0x00008,
   316  #undef AllValues
   317    AllValues    = 0x0000F,
   318  #undef XNegative
   319    XNegative    = 0x00010,
   320  #undef YNegative
   321    YNegative    = 0x00020,
   322    PercentValue = 0x01000, /* % */
   323    AspectValue  = 0x02000, /* ! */
   324    LessValue    = 0x04000, /* < */
   325    GreaterValue = 0x08000, /* > */
   326    AreaValue    = 0x10000, /* @  */
   327    MinimumValue = 0x20000  /* ^ */
   328  } GeometryFlags;
   329  
   330  typedef enum
   331  {
   332  #undef ForgetGravity
   333    ForgetGravity,
   334  #undef NorthWestGravity
   335    NorthWestGravity,
   336  #undef NorthGravity
   337    NorthGravity,
   338  #undef NorthEastGravity
   339    NorthEastGravity,
   340  #undef WestGravity
   341    WestGravity,
   342  #undef CenterGravity
   343    CenterGravity,
   344  #undef EastGravity
   345    EastGravity,
   346  #undef SouthWestGravity
   347    SouthWestGravity,
   348  #undef SouthGravity
   349    SouthGravity,
   350  #undef SouthEastGravity
   351    SouthEastGravity,
   352  #undef StaticGravity
   353    StaticGravity
   354  } GravityType;
   355  
   356  typedef enum
   357  {
   358    UndefinedType,
   359    BilevelType,
   360    GrayscaleType,
   361    GrayscaleMatteType,
   362    PaletteType,
   363    PaletteMatteType,
   364    TrueColorType,
   365    TrueColorMatteType,
   366    ColorSeparationType,
   367    ColorSeparationMatteType,
   368    OptimizeType
   369  } ImageType;
   370  
   371  typedef enum
   372  {
   373    UndefinedInterlace,
   374    NoInterlace,
   375    LineInterlace,
   376    PlaneInterlace,
   377    PartitionInterlace
   378  } InterlaceType;
   379  
   380  typedef enum
   381  {
   382    UndefinedMode,
   383    FrameMode,
   384    UnframeMode,
   385    ConcatenateMode
   386  } MontageMode;
   387  
   388  typedef enum
   389  {
   390    UniformNoise,
   391    GaussianNoise,
   392    MultiplicativeGaussianNoise,
   393    ImpulseNoise,
   394    LaplacianNoise,
   395    PoissonNoise,
   396    /* Below added on 2012-03-17 */
   397    RandomNoise,
   398    UndefinedNoise
   399  } NoiseType;
   400  
   401  /*
   402    Image orientation.  Based on TIFF standard values (also EXIF).
   403  */
   404  typedef enum               /*    Exif     /  Row 0   / Column 0 */
   405                             /* Orientation /  edge    /   edge   */
   406  {                          /* ----------- / -------- / -------- */
   407    UndefinedOrientation,    /*      0      / Unknown  / Unknown  */
   408    TopLeftOrientation,      /*      1      / Left     / Top      */
   409    TopRightOrientation,     /*      2      / Right    / Top      */
   410    BottomRightOrientation,  /*      3      / Right    / Bottom   */
   411    BottomLeftOrientation,   /*      4      / Left     / Bottom   */
   412    LeftTopOrientation,      /*      5      / Top      / Left     */
   413    RightTopOrientation,     /*      6      / Top      / Right    */
   414    RightBottomOrientation,  /*      7      / Bottom   / Right    */
   415    LeftBottomOrientation    /*      8      / Bottom   / Left     */
   416  } OrientationType;
   417  
   418  typedef enum
   419  {
   420    UndefinedPreview = 0,
   421    RotatePreview,
   422    ShearPreview,
   423    RollPreview,
   424    HuePreview,
   425    SaturationPreview,
   426    BrightnessPreview,
   427    GammaPreview,
   428    SpiffPreview,
   429    DullPreview,
   430    GrayscalePreview,
   431    QuantizePreview,
   432    DespecklePreview,
   433    ReduceNoisePreview,
   434    AddNoisePreview,
   435    SharpenPreview,
   436    BlurPreview,
   437    ThresholdPreview,
   438    EdgeDetectPreview,
   439    SpreadPreview,
   440    SolarizePreview,
   441    ShadePreview,
   442    RaisePreview,
   443    SegmentPreview,
   444    SwirlPreview,
   445    ImplodePreview,
   446    WavePreview,
   447    OilPaintPreview,
   448    CharcoalDrawingPreview,
   449    JPEGPreview
   450  } PreviewType;
   451  
   452  typedef enum
   453  {
   454    UndefinedIntent,
   455    SaturationIntent,
   456    PerceptualIntent,
   457    AbsoluteIntent,
   458    RelativeIntent
   459  } RenderingIntent;
   460  
   461  typedef enum
   462  {
   463    UndefinedResolution,
   464    PixelsPerInchResolution,
   465    PixelsPerCentimeterResolution
   466  } ResolutionType;
   467  
   468  /*
   469    Typedef declarations.
   470  */
   471  typedef struct _AffineMatrix
   472  {
   473    double
   474      sx,
   475      rx,
   476      ry,
   477      sy,
   478      tx,
   479      ty;
   480  } AffineMatrix;
   481  
   482  typedef struct _PrimaryInfo
   483  {
   484    double
   485      x,
   486      y,
   487      z;
   488  } PrimaryInfo;
   489  
   490  typedef struct _ChromaticityInfo
   491  {
   492    PrimaryInfo
   493      red_primary,
   494      green_primary,
   495      blue_primary,
   496      white_point;
   497  } ChromaticityInfo;
   498  
   499  #if defined(MAGICK_IMPLEMENTATION)
   500  /*
   501    Useful macros for accessing PixelPacket members in a generic way.
   502  */
   503  # define GetRedSample(p) ((p)->red)
   504  # define GetGreenSample(p) ((p)->green)
   505  # define GetBlueSample(p) ((p)->blue)
   506  # define GetOpacitySample(p) ((p)->opacity)
   507  
   508  # define SetRedSample(q,value) ((q)->red=(value))
   509  # define SetGreenSample(q,value) ((q)->green=(value))
   510  # define SetBlueSample(q,value) ((q)->blue=(value))
   511  # define SetOpacitySample(q,value) ((q)->opacity=(value))
   512  
   513  # define GetGraySample(p) ((p)->red)
   514  # define SetGraySample(q,value) ((q)->red=(q)->green=(q)->blue=(value))
   515  
   516  # define GetYSample(p) ((p)->red)
   517  # define GetCbSample(p) ((p)->green)
   518  # define GetCrSample(p) ((p)->blue)
   519  
   520  # define SetYSample(q,value) ((q)->red=(value))
   521  # define SetCbSample(q,value) ((q)->green=(value))
   522  # define SetCrSample(q,value) ((q)->blue=(value))
   523  
   524  # define GetCyanSample(p) ((p)->red)
   525  # define GetMagentaSample(p) ((p)->green)
   526  # define GetYellowSample(p) ((p)->blue)
   527  # define GetBlackSample(p) ((p)->opacity)
   528  
   529  # define SetCyanSample(q,value) ((q)->red=(value))
   530  # define SetMagentaSample(q,value) ((q)->green=(value))
   531  # define SetYellowSample(q,value) ((q)->blue=(value))
   532  # define SetBlackSample(q,value) ((q)->opacity=(value))
   533  
   534  # define ClearPixelPacket(q) ((q)->red=(q)->green=(q)->blue=(q)->opacity=0)
   535  
   536  #endif /* defined(MAGICK_IMPLEMENTATION) */
   537  
   538  typedef struct _PixelPacket
   539  {
   540  #if defined(WORDS_BIGENDIAN)
   541    /* RGBA */
   542  #define MAGICK_PIXELS_RGBA 1
   543    Quantum
   544      red,
   545      green,
   546      blue,
   547      opacity;
   548  #else
   549    /* BGRA (as used by Microsoft Windows DIB) */
   550  #define MAGICK_PIXELS_BGRA 1
   551    Quantum
   552      blue,
   553      green,
   554      red,
   555      opacity;
   556  #endif
   557  } PixelPacket;
   558  
   559  typedef struct _DoublePixelPacket
   560  {
   561    double
   562      red,
   563      green,
   564      blue,
   565      opacity;
   566  } DoublePixelPacket;
   567  
   568  typedef struct _FloatPixelPacket
   569  {
   570    float
   571      red,
   572      green,
   573      blue,
   574      opacity;
   575  } FloatPixelPacket;
   576  
   577  /*
   578    ErrorInfo is used to record statistical difference (error)
   579    information based on computed Euclidean distance in RGB space.
   580  */
   581  typedef struct _ErrorInfo
   582  {
   583    double
   584      mean_error_per_pixel,     /* Average error per pixel (absolute range) */
   585      normalized_mean_error,    /* Average error per pixel (normalized to 1.0) */
   586      normalized_maximum_error; /* Maximum error encountered (normalized to 1.0) */
   587  } ErrorInfo;
   588  
   589  typedef struct _FrameInfo
   590  {
   591    unsigned long
   592      width,
   593      height;
   594  
   595    long
   596      x,
   597      y,
   598      inner_bevel,
   599      outer_bevel;
   600  } FrameInfo;
   601  
   602  typedef Quantum IndexPacket;
   603  
   604  typedef struct _LongPixelPacket
   605  {
   606    unsigned long
   607      red,
   608      green,
   609      blue,
   610      opacity;
   611  } LongPixelPacket;
   612  
   613  typedef struct _MontageInfo
   614  {
   615    char
   616      *geometry,
   617      *tile,
   618      *title,
   619      *frame,
   620      *texture,
   621      *font;
   622  
   623    double
   624      pointsize;
   625  
   626    unsigned long
   627      border_width;
   628  
   629    unsigned int
   630      shadow;
   631  
   632    PixelPacket
   633      fill,
   634      stroke,
   635      background_color,
   636      border_color,
   637      matte_color;
   638  
   639    GravityType
   640      gravity;
   641  
   642    char
   643      filename[MaxTextExtent];
   644  
   645    unsigned long
   646      signature;
   647  } MontageInfo;
   648  
   649  typedef struct _ProfileInfo
   650  {
   651    size_t
   652      length;
   653  
   654    char
   655      *name;
   656  
   657    unsigned char
   658      *info;
   659  } ProfileInfo;
   660  
   661  typedef struct _RectangleInfo
   662  {
   663    unsigned long
   664      width,
   665      height;
   666  
   667    long
   668      x,
   669      y;
   670  } RectangleInfo;
   671  
   672  typedef struct _SegmentInfo
   673  {
   674    double
   675      x1,
   676      y1,
   677      x2,
   678      y2;
   679  } SegmentInfo;
   680  
   681  struct _ImageExtra;  /* forward decl.; see member "extra" below */
   682  
   683  typedef struct _Image
   684  {
   685    ClassType
   686      storage_class;      /* DirectClass (TrueColor) or PseudoClass (colormapped) */
   687  
   688    ColorspaceType
   689      colorspace;         /* Current image colorspace/model */
   690  
   691    CompressionType
   692      compression;        /* Compression algorithm to use when encoding image */
   693  
   694    MagickBool
   695      dither,             /* True if image is to be dithered */
   696      matte;              /* True if image has an opacity (alpha) channel */
   697  
   698    unsigned long
   699      columns,            /* Number of image columns */
   700      rows;               /* Number of image rows */
   701  
   702    unsigned int
   703      colors,             /* Current number of colors in PseudoClass colormap */
   704      depth;              /* Bits of precision to preserve in color quantum */
   705  
   706    PixelPacket
   707      *colormap;          /* Pseudoclass colormap array */
   708  
   709    PixelPacket
   710      background_color,   /* Background color */
   711      border_color,       /* Border color */
   712      matte_color;        /* Matte (transparent) color */
   713  
   714    double
   715      gamma;              /* Image gamma (e.g. 0.45) */
   716  
   717    ChromaticityInfo
   718      chromaticity;       /* Red, green, blue, and white chromaticity values */
   719  
   720    OrientationType
   721      orientation;        /* Image orientation */
   722  
   723    RenderingIntent
   724      rendering_intent;   /* Rendering intent */
   725  
   726    ResolutionType
   727      units;              /* Units of image resolution (density) */
   728  
   729    char
   730      *montage,           /* Tile size and offset within an image montage */
   731      *directory,         /* Tile names from within an image montage */
   732      *geometry;          /* Composite/Crop options */
   733  
   734    long
   735      offset;             /* Offset to start of image data */
   736  
   737    double
   738      x_resolution,       /* Horizontal resolution (also see units) */
   739      y_resolution;       /* Vertical resolution (also see units) */
   740  
   741    RectangleInfo
   742      page,               /* Offset to apply when placing image */
   743      tile_info;          /* Subregion tile dimensions and offset */
   744  
   745    double
   746      blur,               /* Amount of blur to apply when zooming image */
   747      fuzz;               /* Colors within this distance match target color */
   748  
   749    FilterTypes
   750      filter;             /* Filter to use when zooming image */
   751  
   752    InterlaceType
   753      interlace;          /* Interlace pattern to use when writing image */
   754  
   755    EndianType
   756      endian;             /* Byte order to use when writing image */
   757  
   758    GravityType
   759      gravity;            /* Image placement gravity */
   760  
   761    CompositeOperator
   762      compose;            /* Image placement composition (default OverCompositeOp) */
   763  
   764    DisposeType
   765      dispose;            /* GIF disposal option */
   766  
   767    unsigned long
   768      scene,              /* Animation frame scene number */
   769      delay,              /* Animation frame scene delay */
   770      iterations,         /* Animation iterations */
   771      total_colors;       /* Number of unique colors. See GetNumberColors() */
   772  
   773    long
   774      start_loop;         /* Animation frame number to start looping at */
   775  
   776    ErrorInfo
   777      error;              /* Computed image comparison or quantization error */
   778  
   779    TimerInfo
   780      timer;              /* Operation micro-timer */
   781  
   782    void
   783      *client_data;       /* User specified opaque data pointer */
   784  
   785    /*
   786      Output file name.
   787  
   788      A colon delimited format identifier may be prepended to the file
   789      name in order to force a particular output format. Otherwise the
   790      file extension is used. If no format prefix or file extension is
   791      present, then the output format is determined by the 'magick'
   792      field.
   793    */
   794    char
   795      filename[MaxTextExtent];
   796  
   797    /*
   798      Original file name (name of input image file)
   799    */
   800    char
   801      magick_filename[MaxTextExtent];
   802  
   803    /*
   804      File format of the input file, and the default output format.
   805  
   806      The precedence when selecting the output format is:
   807        1) magick prefix to file name (e.g. "jpeg:foo).
   808        2) file name extension. (e.g. "foo.jpg")
   809        3) content of this magick field.
   810  
   811    */
   812    char
   813      magick[MaxTextExtent];
   814  
   815    /*
   816      Original image width (before transformations)
   817    */
   818    unsigned long
   819      magick_columns;
   820  
   821    /*
   822      Original image height (before transformations)
   823    */
   824    unsigned long
   825      magick_rows;
   826  
   827    ExceptionInfo
   828      exception;          /* Any error associated with this image frame */
   829  
   830    struct _Image
   831      *previous,          /* Pointer to previous frame */
   832      *next;              /* Pointer to next frame */
   833  
   834    /*
   835      To be added here for a later release:
   836  
   837      quality?
   838      subsampling
   839      video black/white setup levels (ReferenceBlack/ReferenceWhite)
   840      sample format (integer/float)
   841     */
   842  
   843    /*
   844      Only private members appear past this point
   845    */
   846  
   847    void                  /* Private, Embedded profiles */
   848      *profiles;
   849  
   850    unsigned int
   851      is_monochrome,      /* Private, True if image is known to be monochrome */
   852      is_grayscale,       /* Private, True if image is known to be grayscale */
   853      taint;              /* Private, True if image has not been modifed */
   854  
   855    /*
   856      Allow for expansion of Image without increasing its size.  The
   857      internals are defined only in image.c.  Clients outside of image.c
   858      can access the internals via the provided access functions (see below).
   859  
   860      This location in Image used to be occupied by Image *clip_mask. The
   861      clip_mask member now lives in _ImageExtra.
   862    */
   863    struct _ImageExtra
   864      *extra;
   865  
   866    MagickBool
   867      ping;               /* Private, if true, pixels are undefined */
   868  
   869    _CacheInfoPtr_
   870      cache;              /* Private, image pixel cache */
   871  
   872    _ThreadViewSetPtr_
   873      default_views;      /* Private, default cache views */
   874  
   875    _ImageAttributePtr_
   876      attributes;         /* Private, Image attribute list */
   877  
   878    _Ascii85InfoPtr_
   879      ascii85;            /* Private, supports huffman encoding */
   880  
   881    _BlobInfoPtr_
   882      blob;               /* Private, file I/O object */
   883  
   884    long
   885      reference_count;    /* Private, Image reference count */
   886  
   887    _SemaphoreInfoPtr_
   888      semaphore;          /* Private, Per image lock (for reference count) */
   889  
   890    unsigned int
   891      logging;            /* Private, True if logging is enabled */
   892  
   893    struct _Image
   894      *list;              /* Private, used only by display */
   895  
   896    unsigned long
   897      signature;          /* Private, Unique code to validate structure */
   898  } Image;
   899  
   900  typedef struct _ImageInfo
   901  {
   902    CompressionType
   903      compression;             /* Image compression to use while decoding */
   904  
   905    MagickBool
   906      temporary,               /* Remove file "filename" once it has been read. */
   907      adjoin,                  /* If True, join multiple frames into one file */
   908      antialias;               /* If True, antialias while rendering */
   909  
   910    unsigned long
   911      subimage,                /* Starting image scene ID to select */
   912      subrange,                /* Span of image scene IDs (from starting scene) to select */
   913      depth;                   /* Number of quantum bits to preserve while encoding */
   914  
   915    char
   916      *size,                   /* Desired/known dimensions to use when decoding image */
   917      *tile,                   /* Deprecated, name of image to tile on background */
   918      *page;                   /* Output page size & offset */
   919  
   920    InterlaceType
   921      interlace;               /* Interlace scheme to use when decoding image */
   922  
   923    EndianType
   924      endian;                  /* Select MSB/LSB endian output for TIFF format */
   925  
   926    ResolutionType
   927      units;                   /* Units to apply when evaluating the density option */
   928  
   929    unsigned long
   930      quality;                 /* Compression quality factor (format specific) */
   931  
   932    char
   933      *sampling_factor,        /* JPEG, MPEG, and YUV chroma downsample factor */
   934      *server_name,            /* X11 server display specification */
   935      *font,                   /* Font name to use for text annotations */
   936      *texture,                /* Name of texture image to use for background fills */
   937      *density;                /* Image resolution (also see units) */
   938  
   939    double
   940      pointsize;               /* Font pointsize */
   941  
   942    double
   943      fuzz;                    /* Colors within this distance are a match */
   944  
   945    PixelPacket
   946      pen,                     /* Stroke or fill color while drawing */
   947      background_color,        /* Background color */
   948      border_color,            /* Border color (color surrounding frame) */
   949      matte_color;             /* Matte color (frame color) */
   950  
   951    MagickBool
   952      dither,                  /* If true, dither image while writing */
   953      monochrome,              /* If true, use monochrome format */
   954      progress;                /* If true, show progress indication */
   955  
   956    ColorspaceType
   957      colorspace;              /* Colorspace representations of image pixels */
   958  
   959    ImageType
   960      type;                    /* Desired image type (used while reading or writing) */
   961  
   962    long
   963      group;                   /* X11 window group ID */
   964  
   965    unsigned int
   966      verbose;                 /* If non-zero, display high-level processing */
   967  
   968    char
   969      *view,                   /* FlashPIX view specification */
   970      *authenticate;           /* Password used to decrypt file */
   971  
   972    void
   973      *client_data;            /* User-specified data to pass to coder */
   974  
   975    FILE
   976      *file;                   /* If not null, stdio FILE * to read image from
   977                                  (fopen mode "rb") or write image to (fopen
   978                                  mode "rb+"). */
   979  
   980    char
   981      magick[MaxTextExtent],   /* File format to read. Overrides file extension */
   982      filename[MaxTextExtent]; /* File name to read */
   983  
   984    /*
   985      Only private members appear past this point
   986    */
   987  
   988    _CacheInfoPtr_
   989       cache;                  /* Private. Used to pass image via open cache */
   990  
   991    void
   992      *definitions;            /* Private. Map of coder specific options passed by user.
   993                                  Use AddDefinitions, RemoveDefinitions, & AccessDefinition
   994                                  to access and manipulate this data. */
   995  
   996    Image
   997      *attributes;             /* Private. Image attribute list */
   998  
   999    MagickBool
  1000      ping;                    /* Private, if true, read file header only */
  1001  
  1002    PreviewType
  1003      preview_type;            /* Private, used by PreviewImage */
  1004  
  1005    MagickBool
  1006      affirm;                  /* Private, when true do not intuit image format */
  1007  
  1008    _BlobInfoPtr_
  1009      blob;                    /* Private, used to pass in open blob */
  1010  
  1011    size_t
  1012      length;                  /* Private, used to pass in open blob length */
  1013  
  1014    char
  1015      unique[MaxTextExtent],   /* Private, passes temporary filename to TranslateText */
  1016      zero[MaxTextExtent];     /* Private, passes temporary filename to TranslateText */
  1017  
  1018    unsigned long
  1019      signature;               /* Private, used to validate structure */
  1020  } ImageInfo;
  1021  
  1022  /*
  1023    Image utilities methods.
  1024  */
  1025  
  1026  extern MagickExport ExceptionType
  1027    CatchImageException(Image *);
  1028  
  1029  extern MagickExport Image
  1030    *AllocateImage(const ImageInfo *),
  1031    *AppendImages(const Image *,const unsigned int,ExceptionInfo *),
  1032    *CloneImage(const Image *,const unsigned long,const unsigned long,
  1033     const unsigned int,ExceptionInfo *),
  1034    *GetImageClipMask(const Image *,ExceptionInfo *),
  1035    *GetImageCompositeMask(const Image *,ExceptionInfo *),  /*to support SVG masks*/
  1036    *ReferenceImage(Image *);
  1037  
  1038  extern MagickExport ImageInfo
  1039    *CloneImageInfo(const ImageInfo *);
  1040  
  1041  extern MagickExport const char
  1042    *AccessDefinition(const ImageInfo *image_info,const char *magick,
  1043       const char *key);
  1044  
  1045  extern MagickExport int
  1046    GetImageGeometry(const Image *,const char *,const unsigned int,
  1047    RectangleInfo *);
  1048  
  1049  /* Functions which return unsigned int as a True/False boolean value */
  1050  extern MagickExport MagickBool
  1051    IsTaintImage(const Image *),
  1052    IsSubimage(const char *,const MagickBool);
  1053  
  1054  /* Functions which return unsigned int to indicate operation pass/fail */
  1055  extern MagickExport MagickPassFail
  1056    AddDefinition(ImageInfo *image_info,const char *magick, const char *key,
  1057      const char *value, ExceptionInfo *exception),
  1058    AddDefinitions(ImageInfo *image_info,const char *options,
  1059      ExceptionInfo *exception),
  1060    AnimateImages(const ImageInfo *image_info,Image *image),
  1061    ClipImage(Image *image),
  1062    ClipPathImage(Image *image,const char *pathname,const MagickBool inside),
  1063    CompositeMaskImage(Image *image),   /*to support SVG masks*/
  1064    CompositePathImage(Image *image,const char *pathname,const MagickBool inside),  /*to support SVG masks*/
  1065    DisplayImages(const ImageInfo *image_info,Image *image),
  1066    RemoveDefinitions(const ImageInfo *image_info,const char *options),
  1067    ResetImagePage(Image *image,const char *page),
  1068    SetImage(Image *image,const Quantum),
  1069    SetImageEx(Image *image,const Quantum opacity,ExceptionInfo *exception),
  1070    SetImageColor(Image *image,const PixelPacket *pixel),
  1071    SetImageColorRegion(Image *image,long x,long y,unsigned long width,
  1072                        unsigned long height,const PixelPacket *pixel),
  1073    SetImageClipMask(Image *image,const Image *clip_mask),
  1074    SetImageCompositeMask(Image *image,const Image *composite_mask),  /*to support SVG masks*/
  1075    SetImageDepth(Image *image,const unsigned long),
  1076    SetImageInfo(ImageInfo *image_info,const unsigned int flags,ExceptionInfo *exception),
  1077    SetImageType(Image *image,const ImageType),
  1078    StripImage(Image *image),
  1079    SyncImage(Image *image);
  1080  
  1081  extern MagickExport void
  1082    AllocateNextImage(const ImageInfo *,Image *),
  1083    DestroyImage(Image *),
  1084    DestroyImageInfo(ImageInfo *),
  1085    GetImageException(Image *,ExceptionInfo *),
  1086    GetImageInfo(ImageInfo *),
  1087    ModifyImage(Image **,ExceptionInfo *),
  1088    SetImageOpacity(Image *,const unsigned int);
  1089  
  1090  /* provide public access to the clip_mask member of Image */
  1091  extern MagickExport Image
  1092    **ImageGetClipMask(const Image *) MAGICK_FUNC_PURE;
  1093  
  1094  /* provide public access to the composite_mask member of Image */
  1095  extern MagickExport Image
  1096    **ImageGetCompositeMask(const Image *) MAGICK_FUNC_PURE;
  1097  
  1098  #if defined(MAGICK_IMPLEMENTATION)
  1099    /*
  1100      SetImageInfo flags specification.
  1101    */
  1102  #  define SETMAGICK_FALSE    0x00000 /* MagickFalse ("read") */
  1103  #  define SETMAGICK_TRUE     0x00001 /* MagickTrue ("write+rectify") */
  1104  #  define SETMAGICK_READ     0x00002 /* Filespec will be read */
  1105  #  define SETMAGICK_WRITE    0x00004 /* Filespec will be written */
  1106  #  define SETMAGICK_RECTIFY  0x00008 /* Look for adjoin in filespec */
  1107  
  1108  #include "magick/image-private.h"
  1109  
  1110  #endif /* defined(MAGICK_IMPLEMENTATION) */
  1111  
  1112  #if defined(__cplusplus) || defined(c_plusplus)
  1113  }
  1114  #endif
  1115  
  1116  #endif /* _MAGICK_IMAGE_H */
  1117  
  1118  /*
  1119   * Local Variables:
  1120   * mode: c
  1121   * c-basic-offset: 2
  1122   * fill-column: 78
  1123   * End:
  1124   */