MagickCore 7.1.1
Convert, Edit, Or Compose Bitmap Images
Loading...
Searching...
No Matches
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 "MagickCore/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)
28extern "C" {
29#endif
30
31#if !defined(MAGICKCORE_QUANTUM_DEPTH)
32#define MAGICKCORE_QUANTUM_DEPTH 16
33#endif
34
35#if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(__MINGW32__)
36# define MagickLLConstant(c) ((MagickOffsetType) (c ## i64))
37# define MagickULLConstant(c) ((MagickSizeType) (c ## ui64))
38#else
39# define MagickLLConstant(c) ((MagickOffsetType) (c ## LL))
40# define MagickULLConstant(c) ((MagickSizeType) (c ## ULL))
41#endif
42
43#if MAGICKCORE_SIZEOF_FLOAT_T == 0
44typedef float MagickFloatType;
45#elif (MAGICKCORE_SIZEOF_FLOAT_T == MAGICKCORE_SIZEOF_FLOAT)
46typedef float MagickFloatType;
47#elif (MAGICKCORE_SIZEOF_FLOAT_T == MAGICKCORE_SIZEOF_DOUBLE)
48typedef double MagickFloatType;
49#elif (MAGICKCORE_SIZEOF_FLOAT_T == MAGICKCORE_SIZEOF_LONG_DOUBLE)
50typedef double MagickFloatType;
51#else
52#error Your MagickFloatType type is neither a float, nor a double, nor a long double
53#endif
54#if MAGICKCORE_SIZEOF_DOUBLE_T == 0
55typedef double MagickDoubleType;
56#elif (MAGICKCORE_SIZEOF_DOUBLE_T == MAGICKCORE_SIZEOF_DOUBLE)
57typedef double MagickDoubleType;
58#elif (MAGICKCORE_SIZEOF_DOUBLE_T == MAGICKCORE_SIZEOF_LONG_DOUBLE)
59typedef double MagickDoubleType;
60#else
61#error Your MagickDoubleType type is neither a float, nor a double, nor a long double
62#endif
63
64#if (MAGICKCORE_QUANTUM_DEPTH == 8)
65#define MaxColormapSize 256UL
66#define MaxMap 255UL
67
68#if defined(MAGICKCORE_HDRI_SUPPORT)
69typedef MagickFloatType Quantum;
70#define QuantumRange ((Quantum) 255.0)
71#define QuantumFormat "%g"
72#else
73typedef unsigned char Quantum;
74#define QuantumRange ((Quantum) 255)
75#define QuantumFormat "%u"
76#endif
77#elif (MAGICKCORE_QUANTUM_DEPTH == 16)
78#define MaxColormapSize 65536UL
79#define MaxMap 65535UL
80
81#if defined(MAGICKCORE_HDRI_SUPPORT)
82typedef MagickFloatType Quantum;
83#define QuantumRange ((Quantum) 65535.0)
84#define QuantumFormat "%g"
85#else
86typedef unsigned short Quantum;
87#define QuantumRange ((Quantum) 65535)
88#define QuantumFormat "%u"
89#endif
90#elif (MAGICKCORE_QUANTUM_DEPTH == 32)
91#define MaxColormapSize 65536UL
92#define MaxMap 65535UL
93
94#if defined(MAGICKCORE_HDRI_SUPPORT)
95typedef MagickDoubleType Quantum;
96#define QuantumRange ((Quantum) 4294967295.0)
97#define QuantumFormat "%g"
98#else
99typedef unsigned int Quantum;
100#define QuantumRange ((Quantum) 4294967295)
101#define QuantumFormat "%u"
102#endif
103#elif (MAGICKCORE_QUANTUM_DEPTH == 64)
104#define MAGICKCORE_HDRI_SUPPORT 1
105#define MaxColormapSize 65536UL
106#define MaxMap 65535UL
107
108typedef MagickDoubleType Quantum;
109#define QuantumRange ((Quantum) 18446744073709551615.0)
110#define QuantumFormat "%g"
111#else
112#error "MAGICKCORE_QUANTUM_DEPTH must be one of 8, 16, 32, or 64"
113#endif
114#define MagickEpsilon 1.0e-12
115#define MagickMaximumValue 1.79769313486231570E+308
116#define MagickMinimumValue 2.22507385850720140E-308
117#define MagickStringify(macro_or_string) MagickStringifyArg(macro_or_string)
118#define MagickStringifyArg(contents) #contents
119#define QuantumScale ((double) 1.0/(double) QuantumRange)
120
121/*
122 Typedef declarations.
123*/
124typedef MagickDoubleType MagickRealType;
125typedef unsigned int MagickStatusType;
126#if !defined(MAGICKCORE_WINDOWS_SUPPORT)
127#if (MAGICKCORE_SIZEOF_UNSIGNED_LONG_LONG == 8)
128typedef long long MagickOffsetType;
129typedef unsigned long long MagickSizeType;
130#define MagickOffsetFormat "lld"
131#define MagickSizeFormat "llu"
132#else
133typedef ssize_t MagickOffsetType;
134typedef size_t MagickSizeType;
135#define MagickOffsetFormat "ld"
136#define MagickSizeFormat "lu"
137#endif
138#else
139typedef __int64 MagickOffsetType;
140typedef unsigned __int64 MagickSizeType;
141#define MagickOffsetFormat "I64i"
142#define MagickSizeFormat "I64u"
143#endif
144
145#if defined(MAGICKCORE_HAVE_UINTPTR_T) || defined(uintptr_t)
146typedef uintptr_t MagickAddressType;
147#else
148/* Hope for the best, I guess. */
149typedef size_t MagickAddressType;
150#endif
151
152typedef MagickSizeType QuantumAny;
153
154typedef enum
155{
156 UndefinedClass,
157 DirectClass,
158 PseudoClass
159} ClassType;
160
161typedef enum
162{
163 MagickFalse = 0,
164 MagickTrue = 1
165} MagickBooleanType;
166
167/*
168 The IsNaN test is for special floating point numbers of value Nan (not a
169 number). NaN's are defined as part of the IEEE standard for floating point
170 number representation, and need to be watched out for. Morphology Kernels
171 often use these special numbers as neighbourhood masks.
172
173 The special property that two NaN's are never equal, even if they are from
174 the same variable allows you to test if a value is special NaN value.
175
176 The macros are thus is only true if the value given is NaN.
177*/
178#if defined(MAGICKCORE_HAVE_ISNAN) && !defined(__cplusplus) && !defined(c_plusplus)
179# define IsNaN(a) isnan(a)
180#elif defined(_MSC_VER)
181# include <float.h>
182# define IsNaN(a) _isnan(a)
183#else
184# define IsNaN(a) ((a) != (a))
185#endif
186#if !defined(INFINITY)
187# define INFINITY ((double) -logf(0f))
188#endif
189
190typedef struct _BlobInfo BlobInfo;
191
192typedef struct _ExceptionInfo ExceptionInfo;
193
194typedef struct _Image Image;
195
196typedef struct _ImageInfo ImageInfo;
197
198#if defined(__cplusplus) || defined(c_plusplus)
199}
200#endif
201
202#endif