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