Home | History | Annotate | Download | only in MagickCore
      1 /*
      2   Copyright 1999-2016 ImageMagick Studio LLC, a non-profit organization
      3   dedicated to making software imaging solutions freely available.
      4 
      5   You may not use this file except in compliance with the License.
      6   obtain a copy of the License at
      7 
      8     http://www.imagemagick.org/script/license.php
      9 
     10   Unless required by applicable law or agreed to in writing, software
     11   distributed under the License is distributed on an "AS IS" BASIS,
     12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13   See the License for the specific language governing permissions and
     14   limitations under the License.
     15 
     16   MagickCore types.
     17 */
     18 #ifndef MAGICKCORE_MAGICK_TYPE_H
     19 #define MAGICKCORE_MAGICK_TYPE_H
     20 
     21 #include "MagickCore/magick-config.h"
     22 
     23 #if defined(__cplusplus) || defined(c_plusplus)
     24 extern "C" {
     25 #endif
     26 
     27 #if !defined(MAGICKCORE_QUANTUM_DEPTH)
     28 #define MAGICKCORE_QUANTUM_DEPTH  16
     29 #endif
     30 
     31 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(__MINGW32__) && !defined(__MINGW64__)
     32 #  define MagickLLConstant(c)  (MagickOffsetType) (c ## i64)
     33 #  define MagickULLConstant(c)  (MagickSizeType) (c ## ui64)
     34 #else
     35 #  define MagickLLConstant(c)  (MagickOffsetType) (c ## LL)
     36 #  define MagickULLConstant(c)  (MagickSizeType) (c ## ULL)
     37 #endif
     38 
     39 #if !defined(MAGICKCORE_HAVE_DOUBLE_T)
     40 typedef double double_t;
     41 #endif
     42 #if !defined(MAGICKCORE_HAVE_FLOAT_T)
     43 typedef float float_t;
     44 #endif
     45 
     46 #if (MAGICKCORE_QUANTUM_DEPTH == 8)
     47 #define MaxColormapSize  256UL
     48 #define MaxMap  255UL
     49 typedef float_t MagickRealType;
     50 
     51 #if defined(MAGICKCORE_HDRI_SUPPORT)
     52 typedef float Quantum;
     53 #define QuantumRange  255.0
     54 #define QuantumFormat  "%g"
     55 #else
     56 typedef unsigned char Quantum;
     57 #define QuantumRange  ((Quantum) 255)
     58 #define QuantumFormat  "%u"
     59 #endif
     60 #elif (MAGICKCORE_QUANTUM_DEPTH == 16)
     61 #define MaxColormapSize  65536UL
     62 #define MaxMap  65535UL
     63 typedef float_t MagickRealType;
     64 
     65 #if defined(MAGICKCORE_HDRI_SUPPORT)
     66 typedef float Quantum;
     67 #define QuantumRange  65535.0f
     68 #define QuantumFormat  "%g"
     69 #else
     70 typedef unsigned short Quantum;
     71 #define QuantumRange  ((Quantum) 65535)
     72 #define QuantumFormat  "%u"
     73 #endif
     74 #elif (MAGICKCORE_QUANTUM_DEPTH == 32)
     75 #define MaxColormapSize  65536UL
     76 #define MaxMap  65535UL
     77 typedef float_t MagickRealType;
     78 
     79 #if defined(MAGICKCORE_HDRI_SUPPORT)
     80 typedef double Quantum;
     81 #define QuantumRange  4294967295.0
     82 #define QuantumFormat  "%g"
     83 #else
     84 typedef unsigned int Quantum;
     85 #define QuantumRange  ((Quantum) 4294967295)
     86 #define QuantumFormat  "%u"
     87 #endif
     88 #elif (MAGICKCORE_QUANTUM_DEPTH == 64)
     89 #define MAGICKCORE_HDRI_SUPPORT
     90 #define MaxColormapSize  65536UL
     91 #define MaxMap  65535UL
     92 
     93 typedef long double MagickRealType;
     94 typedef long double Quantum;
     95 #define QuantumRange  18446744073709551615.0
     96 #define QuantumFormat  "%g"
     97 #else
     98 #error "MAGICKCORE_QUANTUM_DEPTH must be one of 8, 16, 32, or 64"
     99 #endif
    100 #define MagickEpsilon  (1.0e-15)
    101 #define MagickMaximumValue  1.79769313486231570E+308
    102 #define MagickMinimumValue   2.22507385850720140E-308
    103 #define QuantumScale  ((double) 1.0/(double) QuantumRange)
    104 
    105 /*
    106   Typedef declarations.
    107 */
    108 typedef unsigned int MagickStatusType;
    109 #if !defined(MAGICKCORE_WINDOWS_SUPPORT)
    110 #if (MAGICKCORE_SIZEOF_UNSIGNED_LONG_LONG == 8)
    111 typedef long long MagickOffsetType;
    112 typedef unsigned long long MagickSizeType;
    113 #define MagickOffsetFormat  "lld"
    114 #define MagickSizeFormat  "llu"
    115 #else
    116 typedef ssize_t MagickOffsetType;
    117 typedef size_t MagickSizeType;
    118 #define MagickOffsetFormat  "ld"
    119 #define MagickSizeFormat  "lu"
    120 #endif
    121 #else
    122 typedef __int64 MagickOffsetType;
    123 typedef unsigned __int64 MagickSizeType;
    124 #define MagickOffsetFormat  "I64i"
    125 #define MagickSizeFormat  "I64u"
    126 #endif
    127 
    128 #if defined(_MSC_VER) && (_MSC_VER == 1200)
    129 typedef MagickOffsetType QuantumAny;
    130 #else
    131 typedef MagickSizeType QuantumAny;
    132 #endif
    133 
    134 #if defined(macintosh)
    135 #define ExceptionInfo  MagickExceptionInfo
    136 #endif
    137 
    138 typedef enum
    139 {
    140   UndefinedClass,
    141   DirectClass,
    142   PseudoClass
    143 } ClassType;
    144 
    145 typedef enum
    146 {
    147   MagickFalse = 0,
    148   MagickTrue = 1
    149 } MagickBooleanType;
    150 
    151 /*
    152   The IsNaN test is for special floating point numbers of value Nan (not a
    153   number). NaN's are defined as part of the IEEE standard for floating point
    154   number representation, and need to be watched out for. Morphology Kernels
    155   often use these special numbers as neighbourhood masks.
    156 
    157   The special property that two NaN's are never equal, even if they are from
    158   the same variable allows you to test if a value is special NaN value.
    159 
    160   The macros are thus is only true if the value given is NaN.
    161 */
    162 #if defined(MAGICKCORE_HAVE_ISNAN)
    163 #  define IsNaN(a) isnan(a)
    164 #elif defined(_MSC_VER) && (_MSC_VER >= 1310)
    165 #  include <float.h>
    166 #  define IsNaN(a) _isnan(a)
    167 #else
    168 #  define IsNaN(a) (a != a)
    169 #endif
    170 
    171 typedef struct _BlobInfo BlobInfo;
    172 
    173 typedef struct _ExceptionInfo ExceptionInfo;
    174 
    175 typedef struct _Image Image;
    176 
    177 typedef struct _ImageInfo ImageInfo;
    178 
    179 #if defined(__cplusplus) || defined(c_plusplus)
    180 }
    181 #endif
    182 
    183 #endif
    184