MagickCore  6.9.13-44
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 "magick/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 #if !defined(MagickPathExtent)
35 #define MagickPathExtent MaxTextExtent
36 #endif
37 
38 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(__MINGW32__)
39 # define MagickLLConstant(c) ((MagickOffsetType) (c ## i64))
40 # define MagickULLConstant(c) ((MagickSizeType) (c ## ui64))
41 #else
42 # define MagickLLConstant(c) ((MagickOffsetType) (c ## LL))
43 # define MagickULLConstant(c) ((MagickSizeType) (c ## ULL))
44 #endif
45 
46 #if MAGICKCORE_SIZEOF_FLOAT_T == 0
47 typedef float MagickFloatType;
48 #elif (MAGICKCORE_SIZEOF_FLOAT_T == MAGICKCORE_SIZEOF_FLOAT)
49 typedef float MagickFloatType;
50 #elif (MAGICKCORE_SIZEOF_FLOAT_T == MAGICKCORE_SIZEOF_DOUBLE)
51 typedef double MagickFloatType;
52 #elif (MAGICKCORE_SIZEOF_FLOAT_T == MAGICKCORE_SIZEOF_LONG_DOUBLE)
53 typedef double MagickFloatType;
54 #else
55 #error Your MagickFloatType type is neither a float, nor a double, nor a long double
56 #endif
57 #if MAGICKCORE_SIZEOF_DOUBLE_T == 0
58 typedef double MagickDoubleType;
59 #elif (MAGICKCORE_SIZEOF_DOUBLE_T == MAGICKCORE_SIZEOF_DOUBLE)
60 typedef double MagickDoubleType;
61 #elif (MAGICKCORE_SIZEOF_DOUBLE_T == MAGICKCORE_SIZEOF_LONG_DOUBLE)
62 typedef long double MagickDoubleType;
63 #else
64 #error Your MagickDoubleType type is neither a float, nor a double, nor a long double
65 #endif
66 
67 #if (MAGICKCORE_QUANTUM_DEPTH == 8)
68 #define MaxColormapSize 256UL
69 #define MaxMap 255UL
70 typedef ssize_t SignedQuantum;
71 #if defined(MAGICKCORE_HDRI_SUPPORT)
72 typedef MagickFloatType Quantum;
73 #define QuantumRange ((Quantum) 255.0)
74 #define QuantumFormat "%g"
75 #else
76 typedef unsigned char Quantum;
77 #define QuantumRange ((Quantum) 255)
78 #define QuantumFormat "%u"
79 #endif
80 #elif (MAGICKCORE_QUANTUM_DEPTH == 16)
81 #define MaxColormapSize 65536UL
82 #define MaxMap 65535UL
83 typedef ssize_t SignedQuantum;
84 #if defined(MAGICKCORE_HDRI_SUPPORT)
85 typedef MagickFloatType Quantum;
86 #define QuantumRange ((Quantum) 65535.0)
87 #define QuantumFormat "%g"
88 #else
89 typedef unsigned short Quantum;
90 #define QuantumRange ((Quantum) 65535)
91 #define QuantumFormat "%u"
92 #endif
93 #elif (MAGICKCORE_QUANTUM_DEPTH == 32)
94 #define MaxColormapSize 65536UL
95 #define MaxMap 65535UL
96 typedef MagickDoubleType SignedQuantum;
97 #if defined(MAGICKCORE_HDRI_SUPPORT)
98 typedef MagickDoubleType Quantum;
99 #define QuantumRange ((Quantum) 4294967295.0)
100 #define QuantumFormat "%g"
101 #else
102 typedef unsigned int Quantum;
103 #define QuantumRange ((Quantum) 4294967295)
104 #define QuantumFormat "%u"
105 #endif
106 #elif (MAGICKCORE_QUANTUM_DEPTH == 64)
107 #define MAGICKCORE_HDRI_SUPPORT 1
108 #define MaxColormapSize 65536UL
109 #define MaxMap 65535UL
110 typedef MagickDoubleType SignedQuantum;
111 typedef MagickDoubleType Quantum;
112 #define QuantumRange ((Quantum) 18446744073709551615.0)
113 #define QuantumFormat "%g"
114 #else
115 #if !defined(_CH_)
116 # error "MAGICKCORE_QUANTUM_DEPTH must be one of 8, 16, 32, or 64"
117 #endif
118 #endif
119 #define MagickEpsilon (1.0e-12)
120 #define MagickMaximumValue DBL_MAX
121 #define MagickMinimumValue DBL_MIN
122 #define MagickStringify(macro_or_string) MagickStringifyArg(macro_or_string)
123 #define MagickStringifyArg(contents) #contents
124 #define QuantumScale ((double) 1.0/(double) QuantumRange)
125 
126 /*
127  Typedef declarations.
128 */
129 typedef MagickDoubleType MagickRealType;
130 
131 typedef unsigned int MagickStatusType;
132 #if !defined(MAGICKCORE_WINDOWS_SUPPORT)
133 #if (MAGICKCORE_SIZEOF_UNSIGNED_LONG_LONG == 8)
134 typedef long long MagickOffsetType;
135 typedef unsigned long long MagickSizeType;
136 #define MagickOffsetFormat "lld"
137 #define MagickSizeFormat "llu"
138 #define MagickOffsetMax LLONG_MAX
139 #else
140 typedef ssize_t MagickOffsetType;
141 typedef size_t MagickSizeType;
142 #define MagickOffsetFormat "ld"
143 #define MagickSizeFormat "lu"
144 #define MagickOffsetMax SSIZE_MAX
145 #endif
146 #else
147 typedef __int64 MagickOffsetType;
148 typedef unsigned __int64 MagickSizeType;
149 #define MagickOffsetFormat "I64i"
150 #define MagickSizeFormat "I64u"
151 #define MagickOffsetMax _I64_MAX
152 #endif
153 
154 #if defined(MAGICKCORE_HAVE_UINTPTR_T) || defined(uintptr_t)
155 typedef uintptr_t MagickAddressType;
156 #else
157 /* Hope for the best, I guess. */
158 typedef size_t MagickAddressType;
159 #endif
160 
161 #if defined(_MSC_VER) && (_MSC_VER == 1200)
162 typedef MagickOffsetType QuantumAny;
163 #else
164 typedef MagickSizeType QuantumAny;
165 #endif
166 
167 #if defined(macintosh)
168 #define ExceptionInfo MagickExceptionInfo
169 #endif
170 
171 typedef enum
172 {
173  UndefinedChannel,
174  RedChannel = 0x0001,
175  GrayChannel = 0x0001,
176  CyanChannel = 0x0001,
177  GreenChannel = 0x0002,
178  MagentaChannel = 0x0002,
179  BlueChannel = 0x0004,
180  YellowChannel = 0x0004,
181  AlphaChannel = 0x0008,
182  OpacityChannel = 0x0008,
183  MatteChannel = 0x0008, /* deprecated */
184  BlackChannel = 0x0020,
185  IndexChannel = 0x0020,
186  CompositeChannels = 0x002F,
187  AllChannels = 0x7ffffff,
188  /*
189  Special purpose channel types.
190  */
191  TrueAlphaChannel = 0x0040, /* extract actual alpha channel from opacity */
192  RGBChannels = 0x0080, /* set alpha from grayscale mask in RGB */
193  GrayChannels = 0x0080,
194  SyncChannels = 0x0100, /* channels should be modified equally */
195  DefaultChannels = ((AllChannels | SyncChannels) &~ OpacityChannel)
196 } ChannelType;
197 
198 typedef enum
199 {
200  UndefinedClass,
201  DirectClass,
202  PseudoClass
203 } ClassType;
204 
205 typedef enum
206 {
207  MagickFalse = 0,
208  MagickTrue = 1
209 } MagickBooleanType;
210 
211 /*
212  The IsNaN test is for special floating point numbers of value Nan (not a
213  number). NaN's are defined as part of the IEEE standard for floating point
214  number representation, and need to be watched out for. Morphology Kernels
215  often use these special numbers as neighbourhood masks.
216 
217  The special property that two NaN's are never equal, even if they are from
218  the same variable allows you to test if a value is special NaN value.
219 
220  The macros are thus is only true if the value given is NaN.
221 */
222 #if defined(MAGICKCORE_HAVE_ISNAN) && !defined(__cplusplus) && !defined(c_plusplus)
223 # define IsNaN(a) isnan(a)
224 #elif defined(_MSC_VER) && (_MSC_VER >= 1310)
225 # include <float.h>
226 # define IsNaN(a) _isnan(a)
227 #else
228 # define IsNaN(a) ((a) != (a))
229 #endif
230 #if !defined(INFINITY)
231 # define INFINITY ((double) -logf(0f))
232 #endif
233 
234 typedef struct _BlobInfo BlobInfo;
235 
236 typedef struct _ExceptionInfo ExceptionInfo;
237 
238 typedef struct _Image Image;
239 
240 typedef struct _ImageInfo ImageInfo;
241 
242 #if defined(__cplusplus) || defined(c_plusplus)
243 }
244 #endif
245 
246 #endif
Definition: image.h:133