MagickCore  7.1.2-29
Convert, Edit, Or Compose Bitmap Images
magick-type.h
1 /*
2  Copyright @ 1999 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/license/
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(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 ((Quantum) 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 ((Quantum) 65535.0)
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 ((Quantum) 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 ((Quantum) 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 DBL_MAX
116 #define MagickMinimumValue DBL_MIN
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 #define MagickOffsetMax LLONG_MAX
133 #else
134 typedef ssize_t MagickOffsetType;
135 typedef size_t MagickSizeType;
136 #define MagickOffsetFormat "ld"
137 #define MagickSizeFormat "lu"
138 #define MagickOffsetMax SSIZE_MAX
139 #endif
140 #else
141 typedef __int64 MagickOffsetType;
142 typedef unsigned __int64 MagickSizeType;
143 #define MagickOffsetFormat "I64i"
144 #define MagickSizeFormat "I64u"
145 #define MagickOffsetMax _I64_MAX
146 #endif
147 
148 typedef uintptr_t MagickAddressType;
149 
150 typedef MagickSizeType QuantumAny;
151 
152 typedef enum
153 {
154  UndefinedClass,
155  DirectClass,
156  PseudoClass
157 } ClassType;
158 
159 typedef enum
160 {
161  MagickFalse = 0,
162  MagickTrue = 1
163 } MagickBooleanType;
164 
165 /*
166  The IsNaN test is for special floating point numbers of value Nan (not a
167  number). NaN's are defined as part of the IEEE standard for floating point
168  number representation, and need to be watched out for. Morphology Kernels
169  often use these special numbers as neighbourhood masks.
170 
171  The special property that two NaN's are never equal, even if they are from
172  the same variable allows you to test if a value is special NaN value.
173 
174  The macros are thus is only true if the value given is NaN.
175 */
176 #if defined(MAGICKCORE_HAVE_ISNAN) && !defined(__cplusplus) && !defined(c_plusplus)
177 # define IsNaN(a) isnan(a)
178 #elif defined(_MSC_VER)
179 # include <float.h>
180 # define IsNaN(a) _isnan(a)
181 #else
182 # define IsNaN(a) ((a) != (a))
183 #endif
184 #if !defined(INFINITY)
185 # define INFINITY ((double) -logf(0f))
186 #endif
187 
188 typedef struct _BlobInfo BlobInfo;
189 
190 typedef struct _ExceptionInfo ExceptionInfo;
191 
192 typedef struct _Image Image;
193 
194 typedef struct _ImageInfo ImageInfo;
195 
196 #if defined(__cplusplus) || defined(c_plusplus)
197 }
198 #endif
199 
200 #endif
Definition: image.h:132