MagickCore  6.9.12-97
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/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 "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 1.79769313486231570E+308
121 #define MagickMinimumValue 2.22507385850720140E-308
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 #else
139 typedef ssize_t MagickOffsetType;
140 typedef size_t MagickSizeType;
141 #define MagickOffsetFormat "ld"
142 #define MagickSizeFormat "lu"
143 #endif
144 #else
145 typedef __int64 MagickOffsetType;
146 typedef unsigned __int64 MagickSizeType;
147 #define MagickOffsetFormat "I64i"
148 #define MagickSizeFormat "I64u"
149 #endif
150 
151 #if defined(MAGICKCORE_HAVE_UINTPTR_T) || defined(uintptr_t)
152 typedef uintptr_t MagickAddressType;
153 #else
154 /* Hope for the best, I guess. */
155 typedef size_t MagickAddressType;
156 #endif
157 
158 #if defined(_MSC_VER) && (_MSC_VER == 1200)
159 typedef MagickOffsetType QuantumAny;
160 #else
161 typedef MagickSizeType QuantumAny;
162 #endif
163 
164 #if defined(macintosh)
165 #define ExceptionInfo MagickExceptionInfo
166 #endif
167 
168 typedef enum
169 {
170  UndefinedChannel,
171  RedChannel = 0x0001,
172  GrayChannel = 0x0001,
173  CyanChannel = 0x0001,
174  GreenChannel = 0x0002,
175  MagentaChannel = 0x0002,
176  BlueChannel = 0x0004,
177  YellowChannel = 0x0004,
178  AlphaChannel = 0x0008,
179  OpacityChannel = 0x0008,
180  MatteChannel = 0x0008, /* deprecated */
181  BlackChannel = 0x0020,
182  IndexChannel = 0x0020,
183  CompositeChannels = 0x002F,
184  AllChannels = 0x7ffffff,
185  /*
186  Special purpose channel types.
187  */
188  TrueAlphaChannel = 0x0040, /* extract actual alpha channel from opacity */
189  RGBChannels = 0x0080, /* set alpha from grayscale mask in RGB */
190  GrayChannels = 0x0080,
191  SyncChannels = 0x0100, /* channels should be modified equally */
192  DefaultChannels = ((AllChannels | SyncChannels) &~ OpacityChannel)
193 } ChannelType;
194 
195 typedef enum
196 {
197  UndefinedClass,
198  DirectClass,
199  PseudoClass
200 } ClassType;
201 
202 typedef enum
203 {
204  MagickFalse = 0,
205  MagickTrue = 1
206 } MagickBooleanType;
207 
208 /*
209  The IsNaN test is for special floating point numbers of value Nan (not a
210  number). NaN's are defined as part of the IEEE standard for floating point
211  number representation, and need to be watched out for. Morphology Kernels
212  often use these special numbers as neighbourhood masks.
213 
214  The special property that two NaN's are never equal, even if they are from
215  the same variable allows you to test if a value is special NaN value.
216 
217  The macros are thus is only true if the value given is NaN.
218 */
219 #if defined(MAGICKCORE_HAVE_ISNAN) && !defined(__cplusplus) && !defined(c_plusplus)
220 # define IsNaN(a) isnan(a)
221 #elif defined(_MSC_VER) && (_MSC_VER >= 1310)
222 # include <float.h>
223 # define IsNaN(a) _isnan(a)
224 #else
225 # define IsNaN(a) ((a) != (a))
226 #endif
227 #if !defined(INFINITY)
228 # define INFINITY ((double) -logf(0f))
229 #endif
230 
231 typedef struct _BlobInfo BlobInfo;
232 
233 typedef struct _ExceptionInfo ExceptionInfo;
234 
235 typedef struct _Image Image;
236 
237 typedef struct _ImageInfo ImageInfo;
238 
239 #if defined(__cplusplus) || defined(c_plusplus)
240 }
241 #endif
242 
243 #endif
Definition: image.h:153