MagickCore  6.9.11-60
Convert, Edit, Or Compose Bitmap Images
magick-type.h
Go to the documentation of this file.
1 /*
2  Copyright 1999-2021 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(__cplusplus) || defined(c_plusplus)
24 extern "C" {
25 #endif
26 
27 #if !defined(MAGICKCORE_QUANTUM_DEPTH)
28 #define MAGICKCORE_QUANTUM_DEPTH 16
29 #endif
30 #if !defined(MagickPathExtent)
31 #define MagickPathExtent MaxTextExtent
32 #endif
33 
34 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(__MINGW32__)
35 # define MagickLLConstant(c) ((MagickOffsetType) (c ## i64))
36 # define MagickULLConstant(c) ((MagickSizeType) (c ## ui64))
37 #else
38 # define MagickLLConstant(c) ((MagickOffsetType) (c ## LL))
39 # define MagickULLConstant(c) ((MagickSizeType) (c ## ULL))
40 #endif
41 
42 #if defined(__s390__)
43 typedef double MagickFloatType;
44 #else
45 #if MAGICKCORE_SIZEOF_FLOAT_T == 0
46 typedef float MagickFloatType;
47 #elif (MAGICKCORE_SIZEOF_FLOAT_T == MAGICKCORE_SIZEOF_FLOAT)
48 typedef float MagickFloatType;
49 #elif (MAGICKCORE_SIZEOF_FLOAT_T == MAGICKCORE_SIZEOF_DOUBLE)
50 typedef double MagickFloatType;
51 #elif (MAGICKCORE_SIZEOF_FLOAT_T == MAGICKCORE_SIZEOF_LONG_DOUBLE)
52 typedef double MagickFloatType;
53 #else
54 #error Your MagickFloatType type is neither a float, nor a double, nor a long double
55 #endif
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 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 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
97 #if defined(MAGICKCORE_HDRI_SUPPORT)
99 #define QuantumRange 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
111 typedef MagickDoubleType Quantum;
112 #define QuantumRange 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 */
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 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)
160 #else
162 #endif
163 
164 #if defined(macintosh)
165 #define ExceptionInfo MagickExceptionInfo
166 #endif
167 
168 typedef enum
169 {
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,
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 */
194 
195 typedef enum
196 {
201 
202 typedef enum
203 {
205  MagickTrue = 1
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)
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
SyncChannels
@ SyncChannels
Definition: magick-type.h:191
DirectClass
@ DirectClass
Definition: magick-type.h:198
BlueChannel
@ BlueChannel
Definition: magick-type.h:176
MagickStatusType
unsigned int MagickStatusType
Definition: magick-type.h:131
RedChannel
@ RedChannel
Definition: magick-type.h:171
ChannelType
ChannelType
Definition: magick-type.h:169
IndexChannel
@ IndexChannel
Definition: magick-type.h:182
MagickSizeType
size_t MagickSizeType
Definition: magick-type.h:140
magick-config.h
MagickTrue
@ MagickTrue
Definition: magick-type.h:205
MatteChannel
@ MatteChannel
Definition: magick-type.h:180
GrayChannel
@ GrayChannel
Definition: magick-type.h:172
AllChannels
@ AllChannels
Definition: magick-type.h:184
QuantumAny
MagickSizeType QuantumAny
Definition: magick-type.h:161
_BlobInfo
Definition: blob.c:116
_Image
Definition: image.h:153
TrueAlphaChannel
@ TrueAlphaChannel
Definition: magick-type.h:188
OpacityChannel
@ OpacityChannel
Definition: magick-type.h:179
MagentaChannel
@ MagentaChannel
Definition: magick-type.h:175
MagickFloatType
float MagickFloatType
Definition: magick-type.h:46
UndefinedChannel
@ UndefinedChannel
Definition: magick-type.h:170
_ImageInfo
Definition: image.h:362
MagickFalse
@ MagickFalse
Definition: magick-type.h:204
YellowChannel
@ YellowChannel
Definition: magick-type.h:177
DefaultChannels
@ DefaultChannels
Definition: magick-type.h:192
MagickAddressType
size_t MagickAddressType
Definition: magick-type.h:155
BlackChannel
@ BlackChannel
Definition: magick-type.h:181
UndefinedClass
@ UndefinedClass
Definition: magick-type.h:197
MagickBooleanType
MagickBooleanType
Definition: magick-type.h:203
MagickDoubleType
double MagickDoubleType
Definition: magick-type.h:58
_ExceptionInfo
Definition: exception.h:103
MagickRealType
MagickDoubleType MagickRealType
Definition: magick-type.h:129
CompositeChannels
@ CompositeChannels
Definition: magick-type.h:183
PseudoClass
@ PseudoClass
Definition: magick-type.h:199
GrayChannels
@ GrayChannels
Definition: magick-type.h:190
RGBChannels
@ RGBChannels
Definition: magick-type.h:189
SignedQuantum
ssize_t SignedQuantum
Definition: magick-type.h:83
ClassType
ClassType
Definition: magick-type.h:196
GreenChannel
@ GreenChannel
Definition: magick-type.h:174
AlphaChannel
@ AlphaChannel
Definition: magick-type.h:178
CyanChannel
@ CyanChannel
Definition: magick-type.h:173
Quantum
unsigned short Quantum
Definition: magick-type.h:89
MagickOffsetType
ssize_t MagickOffsetType
Definition: magick-type.h:139