MagickCore  7.0.7
Convert, Edit, Or Compose Bitmap Images
static.c
Go to the documentation of this file.
1 /*
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 % %
4 % %
5 % %
6 % SSSSS TTTTT AAA TTTTT IIIII CCCC %
7 % SS T A A T I C %
8 % SSS T AAAAA T I C %
9 % SS T A A T I C %
10 % SSSSS T A A T IIIII CCCC %
11 % %
12 % %
13 % MagickCore Static Methods %
14 % %
15 % Software Design %
16 % Cristy %
17 % March 2000 %
18 % %
19 % %
20 % Copyright 1999-2018 ImageMagick Studio LLC, a non-profit organization %
21 % dedicated to making software imaging solutions freely available. %
22 % %
23 % You may not use this file except in compliance with the License. You may %
24 % obtain a copy of the License at %
25 % %
26 % https://www.imagemagick.org/script/license.php %
27 % %
28 % Unless required by applicable law or agreed to in writing, software %
29 % distributed under the License is distributed on an "AS IS" BASIS, %
30 % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
31 % See the License for the specific language governing permissions and %
32 % limitations under the License. %
33 % %
34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35 %
36 %
37 %
38 */
39 
40 /*
41  Include declarations.
42 */
43 #include "MagickCore/studio.h"
45 #include "MagickCore/image.h"
46 #include "MagickCore/module.h"
47 #include "MagickCore/policy.h"
48 #include "MagickCore/static.h"
49 #include "MagickCore/string_.h"
50 #if !defined(MAGICKCORE_BUILD_MODULES)
51 static const struct
52 {
53  char
54  *name;
55 
56  size_t
57  (*register_module)(void);
58 
59  void
61 } MagickModules[] =
62 {
74 #if defined(MAGICKCORE_WINGDI32_DELEGATE)
76 #endif
83 #if defined(MAGICKCORE_DJVU_DELEGATE)
85 #endif
87 #if defined(MAGICKCORE_DPS_DELEGATE)
89 #endif
91 #if defined(MAGICKCORE_WINGDI32_DELEGATE)
93 #endif
94 #if defined(MAGICKCORE_TIFF_DELEGATE)
96 #endif
97 #if defined(MAGICKCORE_OPENEXR_DELEGATE)
99 #endif
103 #if defined(MAGICKCORE_FLIF_DELEGATE)
105 #endif
106 #if defined(MAGICKCORE_FPX_DELEGATE)
108 #endif
114 #if defined(MAGICKCORE_HEIC_DELEGATE)
116 #endif
124 #if defined(MAGICKCORE_JBIG_DELEGATE)
126 #endif
128 #if defined(MAGICKCORE_JPEG_DELEGATE)
130 #endif
131 #if defined(MAGICKCORE_LIBOPENJP2_DELEGATE)
133 #endif
166 #if defined(MAGICKCORE_PNG_DELEGATE)
168 #endif
191 #if defined(MAGICKCORE_TIFF_DELEGATE)
193 #endif
206 #if defined(MAGICKCORE_WEBP_DELEGATE)
208 #endif
209 #if defined(MAGICKCORE_WMF_DELEGATE) || defined(MAGICKCORE_WMFLITE_DELEGATE)
211 #endif
213 #if defined(MAGICKCORE_X11_DELEGATE)
215 #endif
221 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
223 #endif
224 #if defined(MAGICKCORE_X11_DELEGATE)
226 #endif
229 };
230 #endif
231 
232 /*
233 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
234 % %
235 % %
236 % %
237 % I n v o k e S t a t i c I m a g e F i l t e r %
238 % %
239 % %
240 % %
241 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
242 %
243 % InvokeStaticImageFilter() invokes a static image filter.
244 %
245 % The format of the InvokeStaticImageFilter method is:
246 %
247 % MagickBooleanType InvokeStaticImageFilter(const char *tag,Image **image,
248 % const int argc,const char **argv)
249 %
250 % A description of each parameter follows:
251 %
252 % o tag: the module tag.
253 %
254 % o image: the image.
255 %
256 % o argc: the number of elements in the argument vector.
257 %
258 % o argv: A text array containing the command line arguments.
259 %
260 % o argv: A text array containing the command line arguments.
261 %
262 % o exception: return any errors or warnings in this structure.
263 %
264 */
265 #if defined(MAGICKCORE_MODULES_SUPPORT)
267  Image **image,const int argc,const char **argv,ExceptionInfo *exception)
268 {
270  rights;
271 
272  assert(image != (Image **) NULL);
273  assert((*image)->signature == MagickCoreSignature);
274  if ((*image)->debug != MagickFalse)
275  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",(*image)->filename);
276  rights=ReadPolicyRights;
278  {
279  errno=EPERM;
281  "NotAuthorized","`%s'",tag);
282  return(MagickFalse);
283  }
284 #if defined(MAGICKCORE_BUILD_MODULES)
285  (void) tag;
286  (void) argc;
287  (void) argv;
288  (void) exception;
289 #else
290  {
291  extern size_t
292  analyzeImage(Image **,const int,char **,ExceptionInfo *);
293 
295  *image_filter;
296 
297  image_filter=(ImageFilterHandler *) NULL;
298  if (LocaleCompare("analyze",tag) == 0)
299  image_filter=(ImageFilterHandler *) analyzeImage;
300  if (image_filter == (ImageFilterHandler *) NULL)
302  "UnableToLoadModule","`%s'",tag);
303  else
304  {
305  size_t
306  signature;
307 
308  if ((*image)->debug != MagickFalse)
310  "Invoking \"%s\" static image filter",tag);
311  signature=image_filter(image,argc,argv,exception);
312  if ((*image)->debug != MagickFalse)
313  (void) LogMagickEvent(CoderEvent,GetMagickModule(),"\"%s\" completes",
314  tag);
315  if (signature != MagickImageFilterSignature)
316  {
318  "ImageFilterSignatureMismatch","'%s': %8lx != %8lx",tag,
319  (unsigned long) signature,(unsigned long)
321  return(MagickFalse);
322  }
323  }
324  }
325 #endif
326  return(MagickTrue);
327 }
328 #endif
329 
330 /*
331 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
332 % %
333 % %
334 % %
335 % R e g i s t e r S t a t i c M o d u l e s %
336 % %
337 % %
338 % %
339 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
340 %
341 % (void) RegisterStaticModules() statically registers all the available module
342 % handlers.
343 %
344 % The format of the RegisterStaticModules method is:
345 %
346 % (void) RegisterStaticModules(void)
347 %
348 */
350 {
351 #if !defined(MAGICKCORE_BUILD_MODULES)
352  ssize_t
353  i;
354 
355  for (i=0; i < (ssize_t) (sizeof(MagickModules)/sizeof(MagickModules[0]));i++)
356  (void) (MagickModules[i].register_module)();
357 #endif
358 }
359 
360 /*
361 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
362 % %
363 % %
364 % %
365 % U n r e g i s t e r S t a t i c M o d u l e s %
366 % %
367 % %
368 % %
369 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
370 %
371 % UnregisterStaticModules() statically unregisters all the available module
372 % handlers.
373 %
374 % The format of the UnregisterStaticModules method is:
375 %
376 % UnregisterStaticModules(void)
377 %
378 */
380 {
381 #if !defined(MAGICKCORE_BUILD_MODULES)
382  ssize_t
383  i;
384 
385  for (i=0; i < (ssize_t) (sizeof(MagickModules)/sizeof(MagickModules[0]));i++)
387 #endif
388 }
ModuleExport void UnregisterXCFImage(void)
ModuleExport void UnregisterMAGICKImage(void)
ModuleExport void UnregisterBMPImage(void)
ModuleExport size_t RegisterMASKImage(void)
ModuleExport size_t RegisterIPLImage(void)
ModuleExport void UnregisterLABELImage(void)
ModuleExport void UnregisterRGBImage(void)
ModuleExport void UnregisterAAIImage(void)
ModuleExport void UnregisterVIDImage(void)
ModuleExport void UnregisterBRAILLEImage(void)
ModuleExport size_t RegisterCMYKImage(void)
ModuleExport void UnregisterEXRImage(void)
ModuleExport void UnregisterVIPSImage(void)
ModuleExport size_t RegisterARTImage(void)
MagickExport MagickBooleanType IsRightsAuthorized(const PolicyDomain domain, const PolicyRights rights, const char *pattern)
Definition: policy.c:589
ModuleExport size_t RegisterHDRImage(void)
ModuleExport void UnregisterTIFFImage(void)
ModuleExport size_t RegisterUILImage(void)
ModuleExport size_t RegisterHISTOGRAMImage(void)
ModuleExport size_t RegisterVIDImage(void)
ModuleExport size_t RegisterRLEImage(void)
ModuleExport size_t RegisterPCDImage(void)
ModuleExport void UnregisterUYVYImage(void)
MagickExport void RegisterStaticModules(void)
Definition: static.c:349
ModuleExport void UnregisterDPXImage(void)
ModuleExport size_t RegisterDIBImage(void)
ModuleExport void UnregisterGRADIENTImage(void)
ModuleExport void UnregisterPLASMAImage(void)
ModuleExport size_t RegisterMAPImage(void)
PolicyRights
Definition: policy.h:40
ModuleExport void UnregisterPS3Image(void)
ModuleExport size_t RegisterPATTERNImage(void)
ModuleExport size_t RegisterXCFImage(void)
ModuleExport size_t RegisterWEBPImage(void)
ModuleExport void UnregisterMIFFImage(void)
ModuleExport void UnregisterTTFImage(void)
ModuleExport size_t RegisterGIFImage(void)
ModuleExport void UnregisterBGRImage(void)
ModuleExport size_t RegisterCUTImage(void)
ModuleExport size_t RegisterCIPImage(void)
ModuleExport size_t RegisterCINImage(void)
ModuleExport void UnregisterPCLImage(void)
ModuleExport size_t RegisterLABELImage(void)
ModuleExport size_t RegisterYCBCRImage(void)
ModuleExport size_t RegisterURLImage(void)
ModuleExport size_t RegisterFLIFImage(void)
ModuleExport size_t RegisterMPCImage(void)
ModuleExport void UnregisterHTMLImage(void)
ModuleExport void UnregisterMAPImage(void)
ModuleExport size_t RegisterDEBUGImage(void)
ModuleExport size_t RegisterPSDImage(void)
ModuleExport void UnregisterHEICImage(void)
ModuleExport size_t RegisterBRAILLEImage(void)
ModuleExport size_t RegisterINLINEImage(void)
ModuleExport void UnregisterSGIImage(void)
ModuleExport size_t RegisterPDFImage(void)
ModuleExport size_t RegisterCLIPBOARDImage(void)
ModuleExport void UnregisterTILEImage(void)
ModuleExport void UnregisterIPLImage(void)
ModuleExport size_t RegisterRGFImage(void)
size_t signature
Definition: splay-tree.c:112
ModuleExport size_t RegisterDDSImage(void)
ModuleExport size_t RegisterMPRImage(void)
ModuleExport void UnregisterRAWImage(void)
ModuleExport void UnregisterWBMPImage(void)
ModuleExport size_t RegisterSVGImage(void)
ModuleExport size_t RegisterJBIGImage(void)
ModuleExport void UnregisterXTRNImage(void)
ModuleExport void UnregisterDCMImage(void)
ModuleExport void UnregisterCUTImage(void)
ModuleExport void UnregisterSIXELImage(void)
ModuleExport void UnregisterXImage(void)
char * name
Definition: static.c:54
ModuleExport size_t RegisterBMPImage(void)
ModuleExport void UnregisterPGXImage(void)
ModuleExport size_t RegisterFDImage(void)
ModuleExport size_t RegisterJP2Image(void)
ModuleExport size_t RegisterAVSImage(void)
ModuleExport size_t RegisterGRADIENTImage(void)
ModuleExport void UnregisterSUNImage(void)
ModuleExport size_t RegisterXPSImage(void)
ModuleExport size_t RegisterSCRImage(void)
ModuleExport void UnregisterMPCImage(void)
ModuleExport size_t RegisterFITSImage(void)
ModuleExport void UnregisterAVSImage(void)
size_t(* register_module)(void)
Definition: static.c:57
ModuleExport void UnregisterWEBPImage(void)
Definition: log.h:52
ModuleExport void UnregisterRLEImage(void)
size_t ImageFilterHandler(Image **, const int, const char **, ExceptionInfo *)
Definition: module.h:62
Definition: image.h:151
ModuleExport void UnregisterMASKImage(void)
ModuleExport size_t RegisterJSONImage(void)
ModuleExport void UnregisterEPTImage(void)
ModuleExport size_t RegisterPS3Image(void)
ModuleExport size_t RegisterJPEGImage(void)
ModuleExport size_t RegisterWMFImage(void)
ModuleExport size_t RegisterOTBImage(void)
ModuleExport void UnregisterXWDImage(void)
ModuleExport void UnregisterFITSImage(void)
ModuleExport void UnregisterPICTImage(void)
ModuleExport void UnregisterPIXImage(void)
#define MagickCoreSignature
ModuleExport void UnregisterDDSImage(void)
ModuleExport void UnregisterPS2Image(void)
ModuleExport size_t RegisterPSImage(void)
ModuleExport size_t RegisterPALMImage(void)
ModuleExport void UnregisterMTVImage(void)
ModuleExport size_t RegisterTTFImage(void)
ModuleExport size_t RegisterWBMPImage(void)
ModuleExport size_t RegisterPCXImage(void)
ModuleExport size_t RegisterMATImage(void)
ModuleExport void UnregisterURLImage(void)
ModuleExport size_t RegisterEPTImage(void)
ModuleExport void UnregisterCLIPImage(void)
ModuleExport size_t RegisterSUNImage(void)
#define MagickImageFilterSignature
Definition: module.h:29
ModuleExport size_t RegisterSCREENSHOTImage(void)
MagickBooleanType
Definition: magick-type.h:156
ModuleExport size_t RegisterTGAImage(void)
ModuleExport void UnregisterCAPTIONImage(void)
ModuleExport size_t RegisterVIFFImage(void)
ModuleExport void UnregisterRGFImage(void)
ModuleExport size_t RegisterPCLImage(void)
ModuleExport void UnregisterVIFFImage(void)
ModuleExport size_t RegisterXBMImage(void)
ModuleExport void UnregisterHALDImage(void)
ModuleExport void UnregisterPNGImage(void)
ModuleExport size_t RegisterHEICImage(void)
ModuleExport void UnregisterGRAYImage(void)
ModuleExport void UnregisterMVGImage(void)
ModuleExport size_t RegisterMONOImage(void)
ModuleExport size_t RegisterWPGImage(void)
ModuleExport size_t RegisterSIXELImage(void)
ModuleExport size_t RegisterTIMImage(void)
ModuleExport size_t RegisterAAIImage(void)
ModuleExport void UnregisterHRZImage(void)
ModuleExport size_t RegisterNULLImage(void)
ModuleExport void UnregisterGIFImage(void)
ModuleExport void UnregisterCLIPBOARDImage(void)
ModuleExport void UnregisterINLINEImage(void)
ModuleExport size_t RegisterVIPSImage(void)
ModuleExport void UnregisterMSLImage(void)
ModuleExport void UnregisterFPXImage(void)
ModuleExport void UnregisterHISTOGRAMImage(void)
ModuleExport size_t RegisterEXRImage(void)
ModuleExport void UnregisterTIMImage(void)
ModuleExport size_t RegisterJNXImage(void)
ModuleExport size_t RegisterPS2Image(void)
ModuleExport void UnregisterJNXImage(void)
ModuleExport void UnregisterMACImage(void)
ModuleExport size_t RegisterPIXImage(void)
ModuleExport size_t RegisterCALSImage(void)
ModuleExport void UnregisterPCXImage(void)
ModuleExport size_t RegisterRGBImage(void)
ModuleExport size_t RegisterTILEImage(void)
ModuleExport size_t RegisterMAGICKImage(void)
ModuleExport void UnregisterXPMImage(void)
ModuleExport size_t RegisterTHUMBNAILImage(void)
ModuleExport size_t RegisterTIFFImage(void)
MagickExport MagickBooleanType ThrowMagickException(ExceptionInfo *exception, const char *module, const char *function, const size_t line, const ExceptionType severity, const char *tag, const char *format,...)
Definition: exception.c:1058
MagickExport MagickBooleanType LogMagickEvent(const LogEventType type, const char *module, const char *function, const size_t line, const char *format,...)
Definition: log.c:1397
ModuleExport size_t RegisterPDBImage(void)
ModuleExport void UnregisterXPSImage(void)
ModuleExport void UnregisterPSDImage(void)
ModuleExport size_t RegisterPICTImage(void)
ModuleExport size_t RegisterDPSImage(void)
ModuleExport void UnregisterICONImage(void)
ModuleExport void UnregisterWMFImage(void)
ModuleExport size_t RegisterYUVImage(void)
ModuleExport void UnregisterWPGImage(void)
ModuleExport size_t RegisterMTVImage(void)
ModuleExport void UnregisterMONOImage(void)
ModuleExport size_t RegisterINFOImage(void)
ModuleExport void UnregisterFLIFImage(void)
ModuleExport void UnregisterARTImage(void)
ModuleExport size_t RegisterMIFFImage(void)
ModuleExport void UnregisterINFOImage(void)
ModuleExport void UnregisterCIPImage(void)
ModuleExport void UnregisterTHUMBNAILImage(void)
ModuleExport void UnregisterDEBUGImage(void)
ModuleExport size_t RegisterICONImage(void)
ModuleExport void UnregisterTXTImage(void)
ModuleExport void UnregisterCMYKImage(void)
ModuleExport size_t RegisterMPEGImage(void)
ModuleExport void UnregisterYUVImage(void)
ModuleExport void UnregisterDPSImage(void)
ModuleExport void UnregisterFDImage(void)
ModuleExport size_t RegisterHRZImage(void)
MagickExport int LocaleCompare(const char *p, const char *q)
Definition: locale.c:1409
ModuleExport size_t RegisterBGRImage(void)
#define GetMagickModule()
Definition: log.h:28
ModuleExport void UnregisterXBMImage(void)
ModuleExport size_t RegisterXImage(void)
ModuleExport void UnregisterHDRImage(void)
ModuleExport void UnregisterPDFImage(void)
ModuleExport size_t RegisterXCImage(void)
ModuleExport size_t RegisterCLIPImage(void)
ModuleExport size_t RegisterSGIImage(void)
ModuleExport void UnregisterDJVUImage(void)
ModuleExport void UnregisterSVGImage(void)
ModuleExport void UnregisterPDBImage(void)
ModuleExport size_t RegisterMATTEImage(void)
ModuleExport void UnregisterEMFImage(void)
ModuleExport void UnregisterPESImage(void)
ModuleExport size_t RegisterCAPTIONImage(void)
ModuleExport size_t RegisterDPXImage(void)
ModuleExport void UnregisterMPRImage(void)
ModuleExport void UnregisterPCDImage(void)
ModuleExport void UnregisterVICARImage(void)
ModuleExport size_t RegisterDJVUImage(void)
ModuleExport void UnregisterYCBCRImage(void)
ModuleExport void UnregisterUILImage(void)
ModuleExport void UnregisterMETAImage(void)
ModuleExport size_t RegisterPNMImage(void)
ModuleExport size_t RegisterTXTImage(void)
ModuleExport void UnregisterOTBImage(void)
ModuleExport size_t RegisterRAWImage(void)
ModuleExport void UnregisterPANGOImage(void)
ModuleExport void UnregisterSFWImage(void)
ModuleExport size_t RegisterSTEGANOImage(void)
ModuleExport void UnregisterNULLImage(void)
static const struct @0 MagickModules[]
ModuleExport size_t RegisterDNGImage(void)
ModuleExport size_t RegisterEMFImage(void)
ModuleExport void UnregisterXCImage(void)
ModuleExport void UnregisterJBIGImage(void)
ModuleExport size_t RegisterXPMImage(void)
ModuleExport size_t RegisterSFWImage(void)
ModuleExport size_t RegisterMACImage(void)
ModuleExport void UnregisterPALMImage(void)
ModuleExport void UnregisterFAXImage(void)
ModuleExport size_t RegisterPGXImage(void)
ModuleExport void UnregisterCINImage(void)
ModuleExport void UnregisterMATImage(void)
ModuleExport size_t RegisterMSLImage(void)
ModuleExport void UnregisterJP2Image(void)
ModuleExport size_t RegisterPWPImage(void)
ModuleExport void UnregisterSCRImage(void)
MagickExport void UnregisterStaticModules(void)
Definition: static.c:379
size_t analyzeImage(Image **, const int, const char **, ExceptionInfo *)
ModuleExport void UnregisterCALSImage(void)
ModuleExport void UnregisterMATTEImage(void)
ModuleExport void UnregisterSTEGANOImage(void)
ModuleExport size_t RegisterXWDImage(void)
ModuleExport size_t RegisterDCMImage(void)
ModuleExport size_t RegisterVICARImage(void)
ModuleExport size_t RegisterGRAYImage(void)
ModuleExport size_t RegisterPLASMAImage(void)
ModuleExport void UnregisterPWPImage(void)
ModuleExport void UnregisterSCTImage(void)
#define MagickExport
ModuleExport void UnregisterDNGImage(void)
ModuleExport size_t RegisterUYVYImage(void)
ModuleExport size_t RegisterMVGImage(void)
ModuleExport size_t RegisterXTRNImage(void)
void(* unregister_module)(void)
Definition: static.c:60
ModuleExport size_t RegisterHTMLImage(void)
ModuleExport void UnregisterMPEGImage(void)
ModuleExport size_t RegisterPESImage(void)
ModuleExport size_t RegisterPNGImage(void)
ModuleExport void UnregisterDIBImage(void)
ModuleExport void UnregisterJPEGImage(void)
ModuleExport size_t RegisterFPXImage(void)
ModuleExport void UnregisterRLAImage(void)
ModuleExport void UnregisterPSImage(void)
ModuleExport void UnregisterPNMImage(void)
ModuleExport size_t RegisterRLAImage(void)
MagickExport MagickBooleanType InvokeStaticImageFilter(const char *, Image **, const int, const char **, ExceptionInfo *)
Definition: log.h:41
ModuleExport size_t RegisterFAXImage(void)
ModuleExport size_t RegisterPANGOImage(void)
ModuleExport void UnregisterTGAImage(void)
ModuleExport size_t RegisterSCTImage(void)
ModuleExport void UnregisterPATTERNImage(void)
ModuleExport size_t RegisterMETAImage(void)
ModuleExport size_t RegisterHALDImage(void)
ModuleExport void UnregisterSCREENSHOTImage(void)
ModuleExport void UnregisterJSONImage(void)