MagickWand  6.9.12-27
Convert, Edit, Or Compose Bitmap Images
studio.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  MagickWand private application programming interface declarations.
17 */
18 #ifndef MAGICKWAND_STUDIO_H
19 #define MAGICKWAND_STUDIO_H
20 
21 #if defined(__cplusplus) || defined(c_plusplus)
22 extern "C" {
23 #endif
24 
25 #if defined(WIN32) || defined(WIN64)
26 # define MAGICKWAND_WINDOWS_SUPPORT
27 #else
28 # define MAGICKWAND_POSIX_SUPPORT
29 #endif
30 
31 #define MAGICKWAND_IMPLEMENTATION 1
32 
33 #if !defined(MAGICKWAND_CONFIG_H)
34 # define MAGICKWAND_CONFIG_H
35 # if !defined(vms) && !defined(macintosh)
36 # include "magick/magick-config.h"
37 # else
38 # include "magick-config.h"
39 # endif
40 #if defined(MAGICKCORE__FILE_OFFSET_BITS) && !defined(_FILE_OFFSET_BITS)
41 # define _FILE_OFFSET_BITS MAGICKCORE__FILE_OFFSET_BITS
42 #endif
43 #if defined(_magickcore_const) && !defined(const)
44 # define const _magickcore_const
45 #endif
46 #if defined(_magickcore_inline) && !defined(inline)
47 # define inline _magickcore_inline
48 #endif
49 # if defined(__cplusplus) || defined(c_plusplus)
50 # undef inline
51 # endif
52 #endif
53 
54 #if !defined(const)
55 # define STDC
56 #endif
57 
58 #include <stdarg.h>
59 #include <stdio.h>
60 #if defined(MAGICKCORE_HAVE_SYS_STAT_H)
61 # include <sys/stat.h>
62 #endif
63 #if defined(MAGICKCORE_STDC_HEADERS)
64 # include <stdlib.h>
65 # include <stddef.h>
66 #else
67 # if defined(MAGICKCORE_HAVE_STDLIB_H)
68 # include <stdlib.h>
69 # endif
70 #endif
71 #if !defined(magick_restrict)
72 # if !defined(_magickcore_restrict)
73 # define magick_restrict restrict
74 # else
75 # define magick_restrict _magickcore_restrict
76 # endif
77 #endif
78 #if defined(MAGICKCORE_HAVE_STRING_H)
79 # if !defined(STDC_HEADERS) && defined(MAGICKCORE_HAVE_MEMORY_H)
80 # include <memory.h>
81 # endif
82 # include <string.h>
83 #endif
84 #if defined(MAGICKCORE_HAVE_STRINGS_H)
85 # include <strings.h>
86 #endif
87 #if defined(MAGICKCORE_HAVE_INTTYPES_H)
88 # include <inttypes.h>
89 #endif
90 #if defined(MAGICKCORE_HAVE_STDINT_H)
91 # include <stdint.h>
92 #endif
93 #if defined(MAGICKCORE_HAVE_UNISTD_H)
94 # include <unistd.h>
95 #endif
96 #if defined(MAGICKWAND_WINDOWS_SUPPORT) && defined(_DEBUG)
97 #define _CRTDBG_MAP_ALLOC
98 #endif
99 
100 #if defined(MAGICKWAND_WINDOWS_SUPPORT) && defined(_DEBUG)
101 #define _CRTDBG_MAP_ALLOC
102 #endif
103 #if defined(MAGICKWAND_WINDOWS_SUPPORT)
104 # include <io.h>
105 #if !defined(__CYGWIN__)
106 # include <direct.h>
107 #endif
108 # if !defined(MAGICKCORE_HAVE_STRERROR)
109 # define HAVE_STRERROR
110 # endif
111 #endif
112 
113 #include <ctype.h>
114 #include <locale.h>
115 #include <errno.h>
116 #include <fcntl.h>
117 #include <math.h>
118 #include <time.h>
119 #include <limits.h>
120 #include <signal.h>
121 #include <assert.h>
122 
123 #if defined(MAGICKCORE_HAVE_XLOCALE_H)
124 # include <xlocale.h>
125 #endif
126 #if defined(MAGICKCORE_THREAD_SUPPORT)
127 # include <pthread.h>
128 #endif
129 #if defined(MAGICKCORE_HAVE_SYS_SYSLIMITS_H)
130 # include <sys/syslimits.h>
131 #endif
132 #if defined(MAGICKCORE_HAVE_ARM_LIMITS_H)
133 # include <arm/limits.h>
134 #endif
135 
136 #if defined(MAGICKCORE__OPENCL) && !defined(MAGICK_PIXEL_RGBA)
137 #if defined(MAGICKCORE_HAVE_CL_CL_H)
138 # include <CL/cl.h>
139 #endif
140 #if defined(MAGICKCORE_HAVE_OPENCL_CL_H)
141 # include <OpenCL/cl.h>
142 #endif
143 # define MAGICKCORE_OPENCL_SUPPORT 1
144 #endif
145 
146 #if defined(_OPENMP) && ((_OPENMP >= 200203) || defined(__OPENCC__))
147 # include <omp.h>
148 # define MAGICKCORE_OPENMP_SUPPORT 1
149 #endif
150 
151 #if defined(MAGICKCORE_HAVE_PREAD) && defined(MAGICKCORE_HAVE_DECL_PREAD) && !MAGICKCORE_HAVE_DECL_PREAD
152 ssize_t pread(int,void *,size_t,off_t);
153 #endif
154 
155 #if defined(MAGICKCORE_HAVE_PWRITE) && defined(MAGICKCORE_HAVE_DECL_PWRITE) && !MAGICKCORE_HAVE_DECL_PWRITE
156 ssize_t pwrite(int,const void *,size_t,off_t);
157 #endif
158 
159 #if defined(MAGICKCORE_HAVE_STRLCPY) && defined(MAGICKCORE_HAVE_DECL_STRLCPY) && !MAGICKCORE_HAVE_DECL_STRLCPY
160 extern size_t strlcpy(char *,const char *,size_t);
161 #endif
162 
163 #if defined(MAGICKCORE_HAVE_VSNPRINTF) && defined(MAGICKCORE_HAVE_DECL_VSNPRINTF) && !MAGICKCORE_HAVE_DECL_VSNPRINTF
164 extern int vsnprintf(char *,size_t,const char *,va_list);
165 #endif
166 
167 #if defined(MAGICKWAND_WINDOWS_SUPPORT) || defined(MAGICKWAND_POSIX_SUPPORT)
168 # include <sys/types.h>
169 # include <sys/stat.h>
170 # if defined(MAGICKWAND_POSIX_SUPPORT)
171 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H) || defined(MAGICKCORE_HAVE_SYS_DIR_H) || defined(MAGICKCORE_HAVE_NDIR_H)
172 # define dirent direct
173 # define NAMLEN(dirent) (dirent)->d_namlen
174 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H)
175 # include <sys/ndir.h>
176 # endif
177 # if defined(MAGICKCORE_HAVE_SYS_DIR_H)
178 # include <sys/dir.h>
179 # endif
180 # if defined(MAGICKCORE_HAVE_NDIR_H)
181 # include <ndir.h>
182 # endif
183 # else
184 # include <dirent.h>
185 # define NAMLEN(dirent) strlen((dirent)->d_name)
186 # endif
187 # include <sys/wait.h>
188 # include <pwd.h>
189 # endif
190 # if !defined(S_ISDIR)
191 # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
192 # endif
193 # if !defined(S_ISREG)
194 # define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
195 # endif
196 # include "wand/MagickWand.h"
197 # if !defined(MAGICKWAND_WINDOWS_SUPPORT)
198 # include <sys/time.h>
199 # if defined(MAGICKCORE_HAVE_SYS_TIMES_H)
200 # include <sys/times.h>
201 # endif
202 # if defined(MAGICKCORE_HAVE_SYS_RESOURCE_H)
203 # include <sys/resource.h>
204 # endif
205 # if defined(MAGICKCORE_HAVE_SYS_MMAN_H)
206 # include <sys/mman.h>
207 # endif
208 # if defined(MAGICKCORE_HAVE_SYS_SENDFILE_H)
209 # include <sys/sendfile.h>
210 # endif
211 #endif
212 #else
213 # include <types.h>
214 # include <stat.h>
215 # if defined(macintosh)
216 # if !defined(DISABLE_SIOUX)
217 # include <SIOUX.h>
218 # include <console.h>
219 # endif
220 # include <unix.h>
221 # endif
222 #endif
223 
224 #if defined(S_IRUSR) && defined(S_IWUSR)
225 # define S_MODE (S_IRUSR | S_IWUSR)
226 #elif defined (MAGICKWAND_WINDOWS_SUPPORT)
227 # define S_MODE (_S_IREAD | _S_IWRITE)
228 #else
229 # define S_MODE 0600
230 #endif
231 
232 #if defined(MAGICKWAND_WINDOWS_SUPPORT)
233 # include "magick/nt-base.h"
234 #endif
235 #if defined(macintosh)
236 # include "magick/mac.h"
237 #endif
238 #if defined(vms)
239 # include "magick/vms.h"
240 #endif
241 
242 #include "wand/MagickWand.h"
243 
244 #undef HAVE_CONFIG_H
245 #undef gamma
246 #undef index
247 #undef pipe
248 #undef y1
249 
250 /*
251  Review these platform specific definitions.
252 */
253 #if defined(MAGICKWAND_POSIX_SUPPORT) && !defined(__OS2__)
254 # define DirectorySeparator "/"
255 # define DirectoryListSeparator ':'
256 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
257 # define Exit exit
258 # define IsBasenameSeparator(c) ((c) == '/' ? MagickTrue : MagickFalse)
259 # define X11_PREFERENCES_PATH "~/."
260 # define ProcessPendingEvents(text)
261 # define ReadCommandlLine(argc,argv)
262 # define SetNotifyHandlers
263 #else
264 # if defined(vms)
265 # define X11_APPLICATION_PATH "decw$system_defaults:"
266 # define DirectorySeparator ""
267 # define DirectoryListSeparator ';'
268 # define EditorOptions ""
269 # define Exit exit
270 # define IsBasenameSeparator(c) \
271  (((c) == ']') || ((c) == ':') || ((c) == '/') ? MagickTrue : MagickFalse)
272 # define MAGICKCORE_LIBRARY_PATH "sys$login:"
273 # define MAGICKCORE_SHARE_PATH "sys$login:"
274 # define X11_PREFERENCES_PATH "decw$user_defaults:"
275 # define ProcessPendingEvents(text)
276 # define ReadCommandlLine(argc,argv)
277 # define SetNotifyHandlers
278 # endif
279 # if defined(__OS2__)
280 # define DirectorySeparator "\\"
281 # define DirectoryListSeparator ';'
282 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
283 # define Exit exit
284 # define IsBasenameSeparator(c) \
285  (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
286 # define PreferencesDefaults "~\."
287 # define ProcessPendingEvents(text)
288 # define ReadCommandlLine(argc,argv)
289 # define SetNotifyHandlers
290 #endif
291 # if defined(macintosh)
292 # define X11_APPLICATION_PATH "/usr/lib/X11/app-defaults/"
293 # define DirectorySeparator ":"
294 # define DirectoryListSeparator ';'
295 # define EditorOptions ""
296 # define IsBasenameSeparator(c) ((c) == ':' ? MagickTrue : MagickFalse)
297 # define MAGICKCORE_LIBRARY_PATH ""
298 # define MAGICKCORE_SHARE_PATH ""
299 # define X11_PREFERENCES_PATH "~/."
300 # if defined(DISABLE_SIOUX)
301 # define ReadCommandlLine(argc,argv)
302 # define SetNotifyHandlers \
303  SetFatalErrorHandler(MacFatalErrorHandler); \
304  SetErrorHandler(MACErrorHandler); \
305  SetWarningHandler(MACWarningHandler)
306 # else
307 # define ReadCommandlLine(argc,argv) argc=ccommand(argv); puts(MagickVersion);
308 # define SetNotifyHandlers \
309  SetErrorHandler(MACErrorHandler); \
310  SetWarningHandler(MACWarningHandler)
311 # endif
312 # endif
313 # if defined(MAGICKWAND_WINDOWS_SUPPORT)
314 # define DirectorySeparator "\\"
315 # define DirectoryListSeparator ';'
316 # define EditorOptions ""
317 # define IsBasenameSeparator(c) \
318  (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
319 # define ProcessPendingEvents(text)
320 # if !defined(X11_PREFERENCES_PATH)
321 # define X11_PREFERENCES_PATH "~\\."
322 # endif
323 # define ReadCommandlLine(argc,argv)
324 # define SetNotifyHandlers \
325  SetErrorHandler(NTErrorHandler); \
326  SetWarningHandler(NTWarningHandler)
327 # if !defined(MAGICKCORE_HAVE_TIFFCONF_H)
328 # define HAVE_TIFFCONF_H
329 # endif
330 # endif
331 
332 #endif
333 
334 /*
335  Define system symbols if not already defined.
336 */
337 #if !defined(STDIN_FILENO)
338 #define STDIN_FILENO 0x00
339 #endif
340 
341 #if !defined(O_BINARY)
342 #define O_BINARY 0x00
343 #endif
344 
345 #if !defined(PATH_MAX)
346 #define PATH_MAX 4096
347 #endif
348 
349 /*
350  Magick defines.
351 */
352 #define MAGICK_SSIZE_MAX (SSIZE_MAX)
353 #define MAGICK_SSIZE_MIN (-(SSIZE_MAX)-1)
354 #if defined(_MSC_VER)
355 # define DisableMSCWarning(nr) __pragma(warning(push)) \
356  __pragma(warning(disable:nr))
357 # define RestoreMSCWarning __pragma(warning(pop))
358 #else
359 # define DisableMSCWarning(nr)
360 # define RestoreMSCWarning
361 #endif
362 
363 #if defined(__cplusplus) || defined(c_plusplus)
364 }
365 #endif
366 
367 #endif