2 Copyright 1999-2018 ImageMagick Studio LLC, a non-profit organization
3 dedicated to making software imaging solutions freely available.
5 You may not use this file except in compliance with the License.
6 obtain a copy of the License at
8 https://www.imagemagick.org/script/license.php
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.
18 #ifndef MAGICKCORE_MAGICK_TYPE_H
19 #define MAGICKCORE_MAGICK_TYPE_H
21 #include "MagickCore/magick-config.h"
23 #if defined(__cplusplus) || defined(c_plusplus)
27 #if !defined(MAGICKCORE_QUANTUM_DEPTH)
28 #define MAGICKCORE_QUANTUM_DEPTH 16
31 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(__MINGW32__)
32 # define MagickLLConstant(c) (MagickOffsetType) (c ## i64)
33 # define MagickULLConstant(c) (MagickSizeType) (c ## ui64)
35 # define MagickLLConstant(c) (MagickOffsetType) (c ## LL)
36 # define MagickULLConstant(c) (MagickSizeType) (c ## ULL)
39 #if MAGICKCORE_SIZEOF_FLOAT_T == 0
40 typedef float MagickFloatType;
41 #elif (MAGICKCORE_SIZEOF_FLOAT_T == MAGICKCORE_SIZEOF_FLOAT)
42 typedef float MagickFloatType;
43 #elif (MAGICKCORE_SIZEOF_FLOAT_T == MAGICKCORE_SIZEOF_DOUBLE)
44 typedef double MagickFloatType;
45 #elif (MAGICKCORE_SIZEOF_FLOAT_T == MAGICKCORE_SIZEOF_LONG_DOUBLE)
46 typedef long double MagickFloatType;
48 #error Your MagickFloatType type is neither a float, nor a double, nor a long double
50 #if MAGICKCORE_SIZEOF_DOUBLE_T == 0
51 typedef double MagickDoubleType;
52 #elif (MAGICKCORE_SIZEOF_DOUBLE_T == MAGICKCORE_SIZEOF_DOUBLE)
53 typedef double MagickDoubleType;
54 #elif (MAGICKCORE_SIZEOF_DOUBLE_T == MAGICKCORE_SIZEOF_LONG_DOUBLE)
55 typedef long double MagickDoubleType;
57 #error Your MagickDoubleType type is neither a float, nor a double, nor a long double
60 #if (MAGICKCORE_QUANTUM_DEPTH == 8)
61 #define MaxColormapSize 256UL
64 #if defined(MAGICKCORE_HDRI_SUPPORT)
65 typedef MagickFloatType Quantum;
66 #define QuantumRange 255.0
67 #define QuantumFormat "%g"
69 typedef unsigned char Quantum;
70 #define QuantumRange ((Quantum) 255)
71 #define QuantumFormat "%u"
73 #elif (MAGICKCORE_QUANTUM_DEPTH == 16)
74 #define MaxColormapSize 65536UL
75 #define MaxMap 65535UL
77 #if defined(MAGICKCORE_HDRI_SUPPORT)
78 typedef MagickFloatType Quantum;
79 #define QuantumRange 65535.0f
80 #define QuantumFormat "%g"
82 typedef unsigned short Quantum;
83 #define QuantumRange ((Quantum) 65535)
84 #define QuantumFormat "%u"
86 #elif (MAGICKCORE_QUANTUM_DEPTH == 32)
87 #define MaxColormapSize 65536UL
88 #define MaxMap 65535UL
90 #if defined(MAGICKCORE_HDRI_SUPPORT)
91 typedef MagickDoubleType Quantum;
92 #define QuantumRange 4294967295.0
93 #define QuantumFormat "%g"
95 typedef unsigned int Quantum;
96 #define QuantumRange ((Quantum) 4294967295)
97 #define QuantumFormat "%u"
99 #elif (MAGICKCORE_QUANTUM_DEPTH == 64)
100 #define MAGICKCORE_HDRI_SUPPORT 1
101 #define MaxColormapSize 65536UL
102 #define MaxMap 65535UL
104 typedef MagickDoubleType Quantum;
105 #define QuantumRange 18446744073709551615.0
106 #define QuantumFormat "%g"
108 #error "MAGICKCORE_QUANTUM_DEPTH must be one of 8, 16, 32, or 64"
110 #define MagickEpsilon (1.0e-15)
111 #define MagickMaximumValue 1.79769313486231570E+308
112 #define MagickMinimumValue 2.22507385850720140E-308
113 #define QuantumScale ((double) 1.0/(double) QuantumRange)
116 Typedef declarations.
118 typedef MagickDoubleType MagickRealType;
119 typedef unsigned int MagickStatusType;
120 #if !defined(MAGICKCORE_WINDOWS_SUPPORT)
121 #if (MAGICKCORE_SIZEOF_UNSIGNED_LONG_LONG == 8)
122 typedef long long MagickOffsetType;
123 typedef unsigned long long MagickSizeType;
124 #define MagickOffsetFormat "lld"
125 #define MagickSizeFormat "llu"
127 typedef ssize_t MagickOffsetType;
128 typedef size_t MagickSizeType;
129 #define MagickOffsetFormat "ld"
130 #define MagickSizeFormat "lu"
133 typedef __int64 MagickOffsetType;
134 typedef unsigned __int64 MagickSizeType;
135 #define MagickOffsetFormat "I64i"
136 #define MagickSizeFormat "I64u"
139 #if defined(_MSC_VER) && (_MSC_VER == 1200)
140 typedef MagickOffsetType QuantumAny;
142 typedef MagickSizeType QuantumAny;
145 #if defined(macintosh)
146 #define ExceptionInfo MagickExceptionInfo
163 The IsNaN test is for special floating point numbers of value Nan (not a
164 number). NaN's are defined as part of the IEEE standard for floating point
165 number representation, and need to be watched out for. Morphology Kernels
166 often use these special numbers as neighbourhood masks.
168 The special property that two NaN's are never equal, even if they are from
169 the same variable allows you to test if a value is special NaN value.
171 The macros are thus is only true if the value given is NaN.
173 #if defined(MAGICKCORE_HAVE_ISNAN)
174 # define IsNaN(a) isnan(a)
175 #elif defined(_MSC_VER) && (_MSC_VER >= 1310)
177 # define IsNaN(a) _isnan(a)
179 # define IsNaN(a) (a != a)
181 #if !defined(INFINITY)
182 # define INFINITY (log(0))
185 typedef struct _BlobInfo BlobInfo;
187 typedef struct _ExceptionInfo ExceptionInfo;
189 typedef struct _Image Image;
191 typedef struct _ImageInfo ImageInfo;
193 #if defined(__cplusplus) || defined(c_plusplus)