MagickCore  7.0.10
magick-type.h
Go to the documentation of this file.
1 /*
2  Copyright 1999-2020 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. You may
6  obtain a copy of the License at
7 
8  https://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 
22 
23 #if MAGICKCORE_HAVE_UINTPTR_T
24 # include <stdint.h>
25 #endif
26 
27 #if defined(__cplusplus) || defined(c_plusplus)
28 extern "C" {
29 #endif
30 
31 #if !defined(MAGICKCORE_QUANTUM_DEPTH)
32 #define MAGICKCORE_QUANTUM_DEPTH 16
33 #endif
34 
35 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(__MINGW32__)
36 # define MagickLLConstant(c) ((MagickOffsetType) (c ## i64))
37 # define MagickULLConstant(c) ((MagickSizeType) (c ## ui64))
38 #else
39 # define MagickLLConstant(c) ((MagickOffsetType) (c ## LL))
40 # define MagickULLConstant(c) ((MagickSizeType) (c ## ULL))
41 #endif
42 
43 #if MAGICKCORE_SIZEOF_FLOAT_T == 0
44 typedef float MagickFloatType;
45 #elif (MAGICKCORE_SIZEOF_FLOAT_T == MAGICKCORE_SIZEOF_FLOAT)
46 typedef float MagickFloatType;
47 #elif (MAGICKCORE_SIZEOF_FLOAT_T == MAGICKCORE_SIZEOF_DOUBLE)
48 typedef double MagickFloatType;
49 #elif (MAGICKCORE_SIZEOF_FLOAT_T == MAGICKCORE_SIZEOF_LONG_DOUBLE)
50 typedef double MagickFloatType;
51 #else
52 #error Your MagickFloatType type is neither a float, nor a double, nor a long double
53 #endif
54 #if MAGICKCORE_SIZEOF_DOUBLE_T == 0
55 typedef double MagickDoubleType;
56 #elif (MAGICKCORE_SIZEOF_DOUBLE_T == MAGICKCORE_SIZEOF_DOUBLE)
57 typedef double MagickDoubleType;
58 #elif (MAGICKCORE_SIZEOF_DOUBLE_T == MAGICKCORE_SIZEOF_LONG_DOUBLE)
59 typedef double MagickDoubleType;
60 #else
61 #error Your MagickDoubleType type is neither a float, nor a double, nor a long double
62 #endif
63 
64 #if (MAGICKCORE_QUANTUM_DEPTH == 8)
65 #define MaxColormapSize 256UL
66 #define MaxMap 255UL
67 
68 #if defined(MAGICKCORE_HDRI_SUPPORT)
69 typedef MagickFloatType Quantum;
70 #define QuantumRange 255.0
71 #define QuantumFormat "%g"
72 #else
73 typedef unsigned char Quantum;
74 #define QuantumRange ((Quantum) 255)
75 #define QuantumFormat "%u"
76 #endif
77 #elif (MAGICKCORE_QUANTUM_DEPTH == 16)
78 #define MaxColormapSize 65536UL
79 #define MaxMap 65535UL
80 
81 #if defined(MAGICKCORE_HDRI_SUPPORT)
82 typedef MagickFloatType Quantum;
83 #define QuantumRange 65535.0f
84 #define QuantumFormat "%g"
85 #else
86 typedef unsigned short Quantum;
87 #define QuantumRange ((Quantum) 65535)
88 #define QuantumFormat "%u"
89 #endif
90 #elif (MAGICKCORE_QUANTUM_DEPTH == 32)
91 #define MaxColormapSize 65536UL
92 #define MaxMap 65535UL
93 
94 #if defined(MAGICKCORE_HDRI_SUPPORT)
95 typedef MagickDoubleType Quantum;
96 #define QuantumRange 4294967295.0
97 #define QuantumFormat "%g"
98 #else
99 typedef unsigned int Quantum;
100 #define QuantumRange ((Quantum) 4294967295)
101 #define QuantumFormat "%u"
102 #endif
103 #elif (MAGICKCORE_QUANTUM_DEPTH == 64)
104 #define MAGICKCORE_HDRI_SUPPORT 1
105 #define MaxColormapSize 65536UL
106 #define MaxMap 65535UL
107 
108 typedef MagickDoubleType Quantum;
109 #define QuantumRange 18446744073709551615.0
110 #define QuantumFormat "%g"
111 #else
112 #error "MAGICKCORE_QUANTUM_DEPTH must be one of 8, 16, 32, or 64"
113 #endif
114 #define MagickEpsilon 1.0e-12
115 #define MagickMaximumValue 1.79769313486231570E+308
116 #define MagickMinimumValue 2.22507385850720140E-308
117 #define MagickStringify(macro_or_string) MagickStringifyArg(macro_or_string)
118 #define MagickStringifyArg(contents) #contents
119 #define QuantumScale ((double) 1.0/(double) QuantumRange)
120 
121 /*
122  Typedef declarations.
123 */
124 typedef MagickDoubleType MagickRealType;
125 typedef unsigned int MagickStatusType;
126 #if !defined(MAGICKCORE_WINDOWS_SUPPORT)
127 #if (MAGICKCORE_SIZEOF_UNSIGNED_LONG_LONG == 8)
128 typedef long long MagickOffsetType;
129 typedef unsigned long long MagickSizeType;
130 #define MagickOffsetFormat "lld"
131 #define MagickSizeFormat "llu"
132 #else
133 typedef ssize_t MagickOffsetType;
134 typedef size_t MagickSizeType;
135 #define MagickOffsetFormat "ld"
136 #define MagickSizeFormat "lu"
137 #endif
138 #else
139 typedef __int64 MagickOffsetType;
140 typedef unsigned __int64 MagickSizeType;
141 #define MagickOffsetFormat "I64i"
142 #define MagickSizeFormat "I64u"
143 #endif
144 
145 #if MAGICKCORE_HAVE_UINTPTR_T || defined(uintptr_t)
146 typedef uintptr_t MagickAddressType;
147 #else
148 /* Hope for the best, I guess. */
149 typedef size_t MagickAddressType;
150 #endif
151 
152 #if defined(_MSC_VER) && (_MSC_VER == 1200)
153 typedef MagickOffsetType QuantumAny;
154 #else
155 typedef MagickSizeType QuantumAny;
156 #endif
157 
158 #if defined(macintosh)
159 #define ExceptionInfo MagickExceptionInfo
160 #endif
161 
162 typedef enum
163 {
167 } ClassType;
168 
169 typedef enum
170 {
174 
175 /*
176  The IsNaN test is for special floating point numbers of value Nan (not a
177  number). NaN's are defined as part of the IEEE standard for floating point
178  number representation, and need to be watched out for. Morphology Kernels
179  often use these special numbers as neighbourhood masks.
180 
181  The special property that two NaN's are never equal, even if they are from
182  the same variable allows you to test if a value is special NaN value.
183 
184  The macros are thus is only true if the value given is NaN.
185 */
186 #if defined(MAGICKCORE_HAVE_ISNAN)
187 # define IsNaN(a) isnan(a)
188 #elif defined(_MSC_VER) && (_MSC_VER >= 1310)
189 # include <float.h>
190 # define IsNaN(a) _isnan(a)
191 #else
192 # define IsNaN(a) ((a) != (a))
193 #endif
194 #if !defined(INFINITY)
195 # define INFINITY ((double) -logf(0f))
196 #endif
197 
198 typedef struct _BlobInfo BlobInfo;
199 
201 
202 typedef struct _Image Image;
203 
204 typedef struct _ImageInfo ImageInfo;
205 
206 #if defined(__cplusplus) || defined(c_plusplus)
207 }
208 #endif
209 
210 #endif
MagickDoubleType MagickRealType
Definition: magick-type.h:124
double MagickDoubleType
Definition: magick-type.h:55
float MagickFloatType
Definition: magick-type.h:44
ssize_t MagickOffsetType
Definition: magick-type.h:133
Definition: image.h:151
MagickBooleanType
Definition: magick-type.h:169
unsigned int MagickStatusType
Definition: magick-type.h:125
ClassType
Definition: magick-type.h:162
size_t MagickSizeType
Definition: magick-type.h:134
unsigned short Quantum
Definition: magick-type.h:86
size_t MagickAddressType
Definition: magick-type.h:149
MagickSizeType QuantumAny
Definition: magick-type.h:155