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