Home | History | Annotate | Download | only in MagickWand
      1 /*
      2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      3 %                                                                             %
      4 %                                                                             %
      5 %                                                                             %
      6 %                 M   M   AAA    GGGG  IIIII   CCCC  K   K                    %
      7 %                 MM MM  A   A  G        I    C      K  K                     %
      8 %                 M M M  AAAAA  G GGG    I    C      KKK                      %
      9 %                 M   M  A   A  G   G    I    C      K  K                     %
     10 %                 M   M  A   A   GGGG  IIIII   CCCC  K   K                    %
     11 %                                                                             %
     12 %                        W   W   AAA   N   N  DDDD                            %
     13 %                        W   W  A   A  NN  N  D   D                           %
     14 %                        W W W  AAAAA  N N N  D   D                           %
     15 %                        WW WW  A   A  N  NN  D   D                           %
     16 %                        W   W  A   A  N   N  DDDD                            %
     17 %                                                                             %
     18 %                                                                             %
     19 %                           MagickWand Wand Methods                           %
     20 %                                                                             %
     21 %                               Software Design                               %
     22 %                                    Cristy                                   %
     23 %                                 August 2003                                 %
     24 %                                                                             %
     25 %                                                                             %
     26 %  Copyright 1999-2016 ImageMagick Studio LLC, a non-profit organization      %
     27 %  dedicated to making software imaging solutions freely available.           %
     28 %                                                                             %
     29 %  You may not use this file except in compliance with the License.  You may  %
     30 %  obtain a copy of the License at                                            %
     31 %                                                                             %
     32 %    http://www.imagemagick.org/script/license.php                            %
     33 %                                                                             %
     34 %  Unless required by applicable law or agreed to in writing, software        %
     35 %  distributed under the License is distributed on an "AS IS" BASIS,          %
     36 %  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
     37 %  See the License for the specific language governing permissions and        %
     38 %  limitations under the License.                                             %
     39 %                                                                             %
     40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     41 %
     42 %
     43 %
     44 */
     45 
     46 /*
     48   Include declarations.
     49 */
     50 #include "MagickWand/studio.h"
     51 #include "MagickWand/MagickWand.h"
     52 #include "MagickWand/magick-wand-private.h"
     53 #include "MagickWand/wand.h"
     54 
     55 /*
     57 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     58 %                                                                             %
     59 %                                                                             %
     60 %                                                                             %
     61 %   C l e a r M a g i c k W a n d                                             %
     62 %                                                                             %
     63 %                                                                             %
     64 %                                                                             %
     65 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     66 %
     67 %  ClearMagickWand() clears resources associated with the wand, leaving the
     68 %  wand blank, and ready to be used for a new set of images.
     69 %
     70 %  The format of the ClearMagickWand method is:
     71 %
     72 %      void ClearMagickWand(MagickWand *wand)
     73 %
     74 %  A description of each parameter follows:
     75 %
     76 %    o wand: the magick wand.
     77 %
     78 */
     79 WandExport void ClearMagickWand(MagickWand *wand)
     80 {
     81   assert(wand != (MagickWand *) NULL);
     82   assert(wand->signature == MagickWandSignature);
     83   if (wand->debug != MagickFalse)
     84     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
     85   wand->image_info=DestroyImageInfo(wand->image_info);
     86   wand->images=DestroyImageList(wand->images);
     87   wand->image_info=AcquireImageInfo();
     88   wand->insert_before=MagickFalse;
     89   wand->image_pending=MagickFalse;
     90   ClearMagickException(wand->exception);
     91   wand->debug=IsEventLogging();
     92 }
     93 
     94 /*
     96 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     97 %                                                                             %
     98 %                                                                             %
     99 %                                                                             %
    100 %   C l o n e M a g i c k W a n d                                             %
    101 %                                                                             %
    102 %                                                                             %
    103 %                                                                             %
    104 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    105 %
    106 %  CloneMagickWand() makes an exact copy of the specified wand.
    107 %
    108 %  The format of the CloneMagickWand method is:
    109 %
    110 %      MagickWand *CloneMagickWand(const MagickWand *wand)
    111 %
    112 %  A description of each parameter follows:
    113 %
    114 %    o wand: the magick wand.
    115 %
    116 */
    117 WandExport MagickWand *CloneMagickWand(const MagickWand *wand)
    118 {
    119   MagickWand
    120     *clone_wand;
    121 
    122   assert(wand != (MagickWand *) NULL);
    123   assert(wand->signature == MagickWandSignature);
    124   if (wand->debug != MagickFalse)
    125     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    126   clone_wand=(MagickWand *) AcquireMagickMemory(sizeof(*clone_wand));
    127   if (clone_wand == (MagickWand *) NULL)
    128     ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
    129       wand->name);
    130   (void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
    131   clone_wand->id=AcquireWandId();
    132   (void) FormatLocaleString(clone_wand->name,MagickPathExtent,"%s-%.20g",
    133     MagickWandId,(double) clone_wand->id);
    134   clone_wand->exception=AcquireExceptionInfo();
    135   InheritException(clone_wand->exception,wand->exception);
    136   clone_wand->image_info=CloneImageInfo(wand->image_info);
    137   clone_wand->images=CloneImageList(wand->images,clone_wand->exception);
    138   clone_wand->insert_before=MagickFalse;
    139   clone_wand->image_pending=MagickFalse;
    140   clone_wand->debug=IsEventLogging();
    141   if (clone_wand->debug != MagickFalse)
    142     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
    143   clone_wand->signature=MagickWandSignature;
    144   return(clone_wand);
    145 }
    146 
    147 /*
    149 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    150 %                                                                             %
    151 %                                                                             %
    152 %                                                                             %
    153 %   D e s t r o y M a g i c k W a n d                                         %
    154 %                                                                             %
    155 %                                                                             %
    156 %                                                                             %
    157 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    158 %
    159 %  DestroyMagickWand() deallocates memory associated with an MagickWand.
    160 %
    161 %  The format of the DestroyMagickWand method is:
    162 %
    163 %      MagickWand *DestroyMagickWand(MagickWand *wand)
    164 %
    165 %  A description of each parameter follows:
    166 %
    167 %    o wand: the magick wand.
    168 %
    169 */
    170 WandExport MagickWand *DestroyMagickWand(MagickWand *wand)
    171 {
    172   assert(wand != (MagickWand *) NULL);
    173   assert(wand->signature == MagickWandSignature);
    174   if (wand->debug != MagickFalse)
    175     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    176   wand->images=DestroyImageList(wand->images);
    177   if (wand->image_info != (ImageInfo *) NULL )
    178     wand->image_info=DestroyImageInfo(wand->image_info);
    179   if (wand->exception != (ExceptionInfo *) NULL )
    180     wand->exception=DestroyExceptionInfo(wand->exception);
    181   RelinquishWandId(wand->id);
    182   wand->signature=(~MagickWandSignature);
    183   wand=(MagickWand *) RelinquishMagickMemory(wand);
    184   return(wand);
    185 }
    186 
    187 /*
    189 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    190 %                                                                             %
    191 %                                                                             %
    192 %                                                                             %
    193 %   I s M a g i c k W a n d                                                   %
    194 %                                                                             %
    195 %                                                                             %
    196 %                                                                             %
    197 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    198 %
    199 %  IsMagickWand() returns MagickTrue if the wand is verified as a magick wand.
    200 %
    201 %  The format of the IsMagickWand method is:
    202 %
    203 %      MagickBooleanType IsMagickWand(const MagickWand *wand)
    204 %
    205 %  A description of each parameter follows:
    206 %
    207 %    o wand: the magick wand.
    208 %
    209 */
    210 WandExport MagickBooleanType IsMagickWand(const MagickWand *wand)
    211 {
    212   if (wand == (const MagickWand *) NULL)
    213     return(MagickFalse);
    214   if (wand->signature != MagickWandSignature)
    215     return(MagickFalse);
    216   if (LocaleNCompare(wand->name,MagickWandId,strlen(MagickWandId)) != 0)
    217     return(MagickFalse);
    218   return(MagickTrue);
    219 }
    220 
    221 /*
    223 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    224 %                                                                             %
    225 %                                                                             %
    226 %                                                                             %
    227 %   M a g i c k C l e a r E x c e p t i o n                                   %
    228 %                                                                             %
    229 %                                                                             %
    230 %                                                                             %
    231 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    232 %
    233 %  MagickClearException() clears any exceptions associated with the wand.
    234 %
    235 %  The format of the MagickClearException method is:
    236 %
    237 %      MagickBooleanType MagickClearException(MagickWand *wand)
    238 %
    239 %  A description of each parameter follows:
    240 %
    241 %    o wand: the magick wand.
    242 %
    243 */
    244 WandExport MagickBooleanType MagickClearException(MagickWand *wand)
    245 {
    246   assert(wand != (MagickWand *) NULL);
    247   assert(wand->signature == MagickWandSignature);
    248   if (wand->debug != MagickFalse)
    249     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    250   ClearMagickException(wand->exception);
    251   return(MagickTrue);
    252 }
    253 
    254 /*
    256 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    257 %                                                                             %
    258 %                                                                             %
    259 %                                                                             %
    260 %   M a g i c k G e t E x c e p t i o n                                       %
    261 %                                                                             %
    262 %                                                                             %
    263 %                                                                             %
    264 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    265 %
    266 %  MagickGetException() returns the severity, reason, and description of any
    267 %  error that occurs when using other methods in this API.
    268 %
    269 %  The format of the MagickGetException method is:
    270 %
    271 %      char *MagickGetException(const MagickWand *wand,ExceptionType *severity)
    272 %
    273 %  A description of each parameter follows:
    274 %
    275 %    o wand: the magick wand.
    276 %
    277 %    o severity: the severity of the error is returned here.
    278 %
    279 */
    280 WandExport char *MagickGetException(const MagickWand *wand,
    281   ExceptionType *severity)
    282 {
    283   char
    284     *description;
    285 
    286   assert(wand != (const MagickWand *) NULL);
    287   assert(wand->signature == MagickWandSignature);
    288   if (wand->debug != MagickFalse)
    289     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    290   assert(severity != (ExceptionType *) NULL);
    291   *severity=wand->exception->severity;
    292   description=(char *) AcquireQuantumMemory(2UL*MagickPathExtent,
    293     sizeof(*description));
    294   if (description == (char *) NULL)
    295     {
    296       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
    297         "MemoryAllocationFailed","`%s'",wand->name);
    298       return((char *) NULL);
    299     }
    300   *description='\0';
    301   if (wand->exception->reason != (char *) NULL)
    302     (void) CopyMagickString(description,GetLocaleExceptionMessage(
    303       wand->exception->severity,wand->exception->reason),MagickPathExtent);
    304   if (wand->exception->description != (char *) NULL)
    305     {
    306       (void) ConcatenateMagickString(description," (",MagickPathExtent);
    307       (void) ConcatenateMagickString(description,GetLocaleExceptionMessage(
    308         wand->exception->severity,wand->exception->description),MagickPathExtent);
    309       (void) ConcatenateMagickString(description,")",MagickPathExtent);
    310     }
    311   return(description);
    312 }
    313 
    314 /*
    316 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    317 %                                                                             %
    318 %                                                                             %
    319 %                                                                             %
    320 %   M a g i c k G e t E x c e p t i o n T y p e                               %
    321 %                                                                             %
    322 %                                                                             %
    323 %                                                                             %
    324 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    325 %
    326 %  MagickGetExceptionType() returns the exception type associated with the
    327 %  wand.  If no exception has occurred, UndefinedExceptionType is returned.
    328 %
    329 %  The format of the MagickGetExceptionType method is:
    330 %
    331 %      ExceptionType MagickGetExceptionType(const MagickWand *wand)
    332 %
    333 %  A description of each parameter follows:
    334 %
    335 %    o wand: the magick wand.
    336 %
    337 */
    338 WandExport ExceptionType MagickGetExceptionType(const MagickWand *wand)
    339 {
    340   assert(wand != (MagickWand *) NULL);
    341   assert(wand->signature == MagickWandSignature);
    342   if (wand->debug != MagickFalse)
    343     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    344   return(wand->exception->severity);
    345 }
    346 
    347 /*
    349 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    350 %                                                                             %
    351 %                                                                             %
    352 %                                                                             %
    353 %   M a g i c k G e t I t e r a t o r I n d e x                               %
    354 %                                                                             %
    355 %                                                                             %
    356 %                                                                             %
    357 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    358 %
    359 %  MagickGetIteratorIndex() returns the position of the iterator in the image
    360 %  list.
    361 %
    362 %  The format of the MagickGetIteratorIndex method is:
    363 %
    364 %      ssize_t MagickGetIteratorIndex(MagickWand *wand)
    365 %
    366 %  A description of each parameter follows:
    367 %
    368 %    o wand: the magick wand.
    369 %
    370 */
    371 WandExport ssize_t MagickGetIteratorIndex(MagickWand *wand)
    372 {
    373   assert(wand != (MagickWand *) NULL);
    374   assert(wand->signature == MagickWandSignature);
    375   if (wand->debug != MagickFalse)
    376     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    377   if (wand->images == (Image *) NULL)
    378     {
    379       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
    380         "ContainsNoIterators","`%s'",wand->name);
    381       return(-1);
    382     }
    383   return(GetImageIndexInList(wand->images));
    384 }
    385 
    386 /*
    388 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    389 %                                                                             %
    390 %                                                                             %
    391 %                                                                             %
    392 %   M a g i c k Q u e r y C o n f i g u r e O p t i o n                       %
    393 %                                                                             %
    394 %                                                                             %
    395 %                                                                             %
    396 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    397 %
    398 %  MagickQueryConfigureOption() returns the value associated with the specified
    399 %  configure option.
    400 %
    401 %  The format of the MagickQueryConfigureOption function is:
    402 %
    403 %      char *MagickQueryConfigureOption(const char *option)
    404 %
    405 %  A description of each parameter follows:
    406 %
    407 %    o option: the option name.
    408 %
    409 */
    410 WandExport char *MagickQueryConfigureOption(const char *option)
    411 {
    412   char
    413     *value;
    414 
    415   const ConfigureInfo
    416     **configure_info;
    417 
    418   ExceptionInfo
    419     *exception;
    420 
    421   size_t
    422     number_options;
    423 
    424   exception=AcquireExceptionInfo();
    425   configure_info=GetConfigureInfoList(option,&number_options,exception);
    426   exception=DestroyExceptionInfo(exception);
    427   if (configure_info == (const ConfigureInfo **) NULL)
    428     return((char *) NULL);
    429   value=AcquireString(configure_info[0]->value);
    430   configure_info=(const ConfigureInfo **)
    431     RelinquishMagickMemory((void *) configure_info);
    432   return(value);
    433 }
    434 
    435 /*
    437 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    438 %                                                                             %
    439 %                                                                             %
    440 %                                                                             %
    441 %   M a g i c k Q u e r y C o n f i g u r e O p t i o n s                     %
    442 %                                                                             %
    443 %                                                                             %
    444 %                                                                             %
    445 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    446 %
    447 %  MagickQueryConfigureOptions() returns any configure options that match the
    448 %  specified pattern (e.g.  "*" for all).  Options include NAME, VERSION,
    449 %  LIB_VERSION, etc.
    450 %
    451 %  The format of the MagickQueryConfigureOptions function is:
    452 %
    453 %      char **MagickQueryConfigureOptions(const char *pattern,
    454 %        size_t *number_options)
    455 %
    456 %  A description of each parameter follows:
    457 %
    458 %    o pattern: Specifies a pointer to a text string containing a pattern.
    459 %
    460 %    o number_options:  Returns the number of configure options in the list.
    461 %
    462 %
    463 */
    464 WandExport char **MagickQueryConfigureOptions(const char *pattern,
    465   size_t *number_options)
    466 {
    467   char
    468     **options;
    469 
    470   ExceptionInfo
    471     *exception;
    472 
    473   exception=AcquireExceptionInfo();
    474   options=GetConfigureList(pattern,number_options,exception);
    475   exception=DestroyExceptionInfo(exception);
    476   return(options);
    477 }
    478 
    479 /*
    481 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    482 %                                                                             %
    483 %                                                                             %
    484 %                                                                             %
    485 %   M a g i c k Q u e r y F o n t M e t r i c s                               %
    486 %                                                                             %
    487 %                                                                             %
    488 %                                                                             %
    489 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    490 %
    491 %  MagickQueryFontMetrics() returns a 13 element array representing the
    492 %  following font metrics:
    493 %
    494 %    Element Description
    495 %    -------------------------------------------------
    496 %          0 character width
    497 %          1 character height
    498 %          2 ascender
    499 %          3 descender
    500 %          4 text width
    501 %          5 text height
    502 %          6 maximum horizontal advance
    503 %          7 bounding box: x1
    504 %          8 bounding box: y1
    505 %          9 bounding box: x2
    506 %         10 bounding box: y2
    507 %         11 origin: x
    508 %         12 origin: y
    509 %
    510 %  The format of the MagickQueryFontMetrics method is:
    511 %
    512 %      double *MagickQueryFontMetrics(MagickWand *wand,
    513 %        const DrawingWand *drawing_wand,const char *text)
    514 %
    515 %  A description of each parameter follows:
    516 %
    517 %    o wand: the Magick wand.
    518 %
    519 %    o drawing_wand: the drawing wand.
    520 %
    521 %    o text: the text.
    522 %
    523 */
    524 WandExport double *MagickQueryFontMetrics(MagickWand *wand,
    525   const DrawingWand *drawing_wand,const char *text)
    526 {
    527   double
    528     *font_metrics;
    529 
    530   DrawInfo
    531     *draw_info;
    532 
    533   MagickBooleanType
    534     status;
    535 
    536   TypeMetric
    537     metrics;
    538 
    539   assert(wand != (MagickWand *) NULL);
    540   assert(wand->signature == MagickWandSignature);
    541   if (wand->debug != MagickFalse)
    542     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    543   assert(drawing_wand != (const DrawingWand *) NULL);
    544   if (wand->images == (Image *) NULL)
    545     {
    546       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
    547         "ContainsNoImages","`%s'",wand->name);
    548       return((double *) NULL);
    549     }
    550   font_metrics=(double *) AcquireQuantumMemory(13UL,sizeof(*font_metrics));
    551   if (font_metrics == (double *) NULL)
    552     return((double *) NULL);
    553   draw_info=PeekDrawingWand(drawing_wand);
    554   if (draw_info == (DrawInfo *) NULL)
    555     {
    556       font_metrics=(double *) RelinquishMagickMemory(font_metrics);
    557       return((double *) NULL);
    558     }
    559   (void) CloneString(&draw_info->text,text);
    560   (void) ResetMagickMemory(&metrics,0,sizeof(metrics));
    561   status=GetTypeMetrics(wand->images,draw_info,&metrics,wand->exception);
    562   draw_info=DestroyDrawInfo(draw_info);
    563   if (status == MagickFalse)
    564     {
    565       font_metrics=(double *) RelinquishMagickMemory(font_metrics);
    566       return((double *) NULL);
    567     }
    568   font_metrics[0]=metrics.pixels_per_em.x;
    569   font_metrics[1]=metrics.pixels_per_em.y;
    570   font_metrics[2]=metrics.ascent;
    571   font_metrics[3]=metrics.descent;
    572   font_metrics[4]=metrics.width;
    573   font_metrics[5]=metrics.height;
    574   font_metrics[6]=metrics.max_advance;
    575   font_metrics[7]=metrics.bounds.x1;
    576   font_metrics[8]=metrics.bounds.y1;
    577   font_metrics[9]=metrics.bounds.x2;
    578   font_metrics[10]=metrics.bounds.y2;
    579   font_metrics[11]=metrics.origin.x;
    580   font_metrics[12]=metrics.origin.y;
    581   return(font_metrics);
    582 }
    583 
    584 /*
    586 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    587 %                                                                             %
    588 %                                                                             %
    589 %                                                                             %
    590 %   M a g i c k Q u e r y M u l t i l i n e F o n t M e t r i c s             %
    591 %                                                                             %
    592 %                                                                             %
    593 %                                                                             %
    594 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    595 %
    596 %  MagickQueryMultilineFontMetrics() returns a 13 element array representing the
    597 %  following font metrics:
    598 %
    599 %    Element Description
    600 %    -------------------------------------------------
    601 %          0 character width
    602 %          1 character height
    603 %          2 ascender
    604 %          3 descender
    605 %          4 text width
    606 %          5 text height
    607 %          6 maximum horizontal advance
    608 %          7 bounding box: x1
    609 %          8 bounding box: y1
    610 %          9 bounding box: x2
    611 %         10 bounding box: y2
    612 %         11 origin: x
    613 %         12 origin: y
    614 %
    615 %  This method is like MagickQueryFontMetrics() but it returns the maximum text
    616 %  width and height for multiple lines of text.
    617 %
    618 %  The format of the MagickQueryFontMetrics method is:
    619 %
    620 %      double *MagickQueryMultilineFontMetrics(MagickWand *wand,
    621 %        const DrawingWand *drawing_wand,const char *text)
    622 %
    623 %  A description of each parameter follows:
    624 %
    625 %    o wand: the Magick wand.
    626 %
    627 %    o drawing_wand: the drawing wand.
    628 %
    629 %    o text: the text.
    630 %
    631 */
    632 WandExport double *MagickQueryMultilineFontMetrics(MagickWand *wand,
    633   const DrawingWand *drawing_wand,const char *text)
    634 {
    635   double
    636     *font_metrics;
    637 
    638   DrawInfo
    639     *draw_info;
    640 
    641   MagickBooleanType
    642     status;
    643 
    644   TypeMetric
    645     metrics;
    646 
    647   assert(wand != (MagickWand *) NULL);
    648   assert(wand->signature == MagickWandSignature);
    649   if (wand->debug != MagickFalse)
    650     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    651   assert(drawing_wand != (const DrawingWand *) NULL);
    652   if (wand->images == (Image *) NULL)
    653     {
    654       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
    655         "ContainsNoImages","`%s'",wand->name);
    656       return((double *) NULL);
    657     }
    658   font_metrics=(double *) AcquireQuantumMemory(13UL,sizeof(*font_metrics));
    659   if (font_metrics == (double *) NULL)
    660     return((double *) NULL);
    661   draw_info=PeekDrawingWand(drawing_wand);
    662   if (draw_info == (DrawInfo *) NULL)
    663     {
    664       font_metrics=(double *) RelinquishMagickMemory(font_metrics);
    665       return((double *) NULL);
    666     }
    667   (void) CloneString(&draw_info->text,text);
    668   (void) ResetMagickMemory(&metrics,0,sizeof(metrics));
    669   status=GetMultilineTypeMetrics(wand->images,draw_info,&metrics,
    670     wand->exception);
    671   draw_info=DestroyDrawInfo(draw_info);
    672   if (status == MagickFalse)
    673     {
    674       font_metrics=(double *) RelinquishMagickMemory(font_metrics);
    675       return((double *) NULL);
    676     }
    677   font_metrics[0]=metrics.pixels_per_em.x;
    678   font_metrics[1]=metrics.pixels_per_em.y;
    679   font_metrics[2]=metrics.ascent;
    680   font_metrics[3]=metrics.descent;
    681   font_metrics[4]=metrics.width;
    682   font_metrics[5]=metrics.height;
    683   font_metrics[6]=metrics.max_advance;
    684   font_metrics[7]=metrics.bounds.x1;
    685   font_metrics[8]=metrics.bounds.y1;
    686   font_metrics[9]=metrics.bounds.x2;
    687   font_metrics[10]=metrics.bounds.y2;
    688   font_metrics[11]=metrics.origin.x;
    689   font_metrics[12]=metrics.origin.y;
    690   return(font_metrics);
    691 }
    692 
    693 /*
    695 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    696 %                                                                             %
    697 %                                                                             %
    698 %                                                                             %
    699 %   M a g i c k Q u e r y F o n t s                                           %
    700 %                                                                             %
    701 %                                                                             %
    702 %                                                                             %
    703 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    704 %
    705 %  MagickQueryFonts() returns any font that match the specified pattern (e.g.
    706 %  "*" for all).
    707 %
    708 %  The format of the MagickQueryFonts function is:
    709 %
    710 %      char **MagickQueryFonts(const char *pattern,size_t *number_fonts)
    711 %
    712 %  A description of each parameter follows:
    713 %
    714 %    o pattern: Specifies a pointer to a text string containing a pattern.
    715 %
    716 %    o number_fonts:  Returns the number of fonts in the list.
    717 %
    718 %
    719 */
    720 WandExport char **MagickQueryFonts(const char *pattern,
    721   size_t *number_fonts)
    722 {
    723   char
    724     **fonts;
    725 
    726   ExceptionInfo
    727     *exception;
    728 
    729   exception=AcquireExceptionInfo();
    730   fonts=GetTypeList(pattern,number_fonts,exception);
    731   exception=DestroyExceptionInfo(exception);
    732   return(fonts);
    733 }
    734 
    735 /*
    737 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    738 %                                                                             %
    739 %                                                                             %
    740 %                                                                             %
    741 %   M a g i c k Q u e r y F o r m a t s                                       %
    742 %                                                                             %
    743 %                                                                             %
    744 %                                                                             %
    745 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    746 %
    747 %  MagickQueryFormats() returns any image formats that match the specified
    748 %  pattern (e.g.  "*" for all).
    749 %
    750 %  The format of the MagickQueryFormats function is:
    751 %
    752 %      char **MagickQueryFormats(const char *pattern,size_t *number_formats)
    753 %
    754 %  A description of each parameter follows:
    755 %
    756 %    o pattern: Specifies a pointer to a text string containing a pattern.
    757 %
    758 %    o number_formats:  This integer returns the number of image formats in the
    759 %      list.
    760 %
    761 */
    762 WandExport char **MagickQueryFormats(const char *pattern,
    763   size_t *number_formats)
    764 {
    765   char
    766     **formats;
    767 
    768   ExceptionInfo
    769     *exception;
    770 
    771   exception=AcquireExceptionInfo();
    772   formats=GetMagickList(pattern,number_formats,exception);
    773   exception=DestroyExceptionInfo(exception);
    774   return(formats);
    775 }
    776 
    777 /*
    779 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    780 %                                                                             %
    781 %                                                                             %
    782 %                                                                             %
    783 %   M a g i c k R e l i n q u i s h M e m o r y                               %
    784 %                                                                             %
    785 %                                                                             %
    786 %                                                                             %
    787 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    788 %
    789 %  MagickRelinquishMemory() relinquishes memory resources returned by such
    790 %  methods as MagickIdentifyImage(), MagickGetException(), etc.
    791 %
    792 %  The format of the MagickRelinquishMemory method is:
    793 %
    794 %      void *MagickRelinquishMemory(void *resource)
    795 %
    796 %  A description of each parameter follows:
    797 %
    798 %    o resource: Relinquish the memory associated with this resource.
    799 %
    800 */
    801 WandExport void *MagickRelinquishMemory(void *memory)
    802 {
    803   (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
    804   return(RelinquishMagickMemory(memory));
    805 }
    806 
    807 /*
    809 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    810 %                                                                             %
    811 %                                                                             %
    812 %                                                                             %
    813 %   M a g i c k R e s e t I t e r a t o r                                     %
    814 %                                                                             %
    815 %                                                                             %
    816 %                                                                             %
    817 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    818 %
    819 %  MagickResetIterator() resets the wand iterator.
    820 %
    821 %  It is typically used either before iterating though images, or before
    822 %  calling specific functions such as  MagickAppendImages() to append all
    823 %  images together.
    824 %
    825 %  Afterward you can use MagickNextImage() to iterate over all the images
    826 %  in a wand container, starting with the first image.
    827 %
    828 %  Using this before MagickAddImages() or MagickReadImages() will cause
    829 %  new images to be inserted between the first and second image.
    830 %
    831 %  The format of the MagickResetIterator method is:
    832 %
    833 %      void MagickResetIterator(MagickWand *wand)
    834 %
    835 %  A description of each parameter follows:
    836 %
    837 %    o wand: the magick wand.
    838 %
    839 */
    840 WandExport void MagickResetIterator(MagickWand *wand)
    841 {
    842   assert(wand != (MagickWand *) NULL);
    843   assert(wand->signature == MagickWandSignature);
    844   if (wand->debug != MagickFalse)
    845     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    846   wand->images=GetFirstImageInList(wand->images);
    847   wand->insert_before=MagickFalse; /* Insert/add after current (first) image */
    848   wand->image_pending=MagickTrue;  /* NextImage will set first image */
    849 }
    850 
    851 /*
    853 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    854 %                                                                             %
    855 %                                                                             %
    856 %                                                                             %
    857 %   M a g i c k S e t F i r s t I t e r a t o r                               %
    858 %                                                                             %
    859 %                                                                             %
    860 %                                                                             %
    861 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    862 %
    863 %  MagickSetFirstIterator() sets the wand iterator to the first image.
    864 %
    865 %  After using any images added to the wand using MagickAddImage() or
    866 %  MagickReadImage() will be prepended before any image in the wand.
    867 %
    868 %  Also the current image has been set to the first image (if any) in the
    869 %  Magick Wand.  Using MagickNextImage() will then set teh current image
    870 %  to the second image in the list (if present).
    871 %
    872 %  This operation is similar to MagickResetIterator() but differs in how
    873 %  MagickAddImage(), MagickReadImage(), and MagickNextImage() behaves
    874 %  afterward.
    875 %
    876 %  The format of the MagickSetFirstIterator method is:
    877 %
    878 %      void MagickSetFirstIterator(MagickWand *wand)
    879 %
    880 %  A description of each parameter follows:
    881 %
    882 %    o wand: the magick wand.
    883 %
    884 */
    885 WandExport void MagickSetFirstIterator(MagickWand *wand)
    886 {
    887   assert(wand != (MagickWand *) NULL);
    888   assert(wand->signature == MagickWandSignature);
    889   if (wand->debug != MagickFalse)
    890     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    891   wand->images=GetFirstImageInList(wand->images);
    892   wand->insert_before=MagickTrue;   /* Insert/add before the first image */
    893   wand->image_pending=MagickFalse;  /* NextImage will set next image */
    894 }
    895 
    896 /*
    898 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    899 %                                                                             %
    900 %                                                                             %
    901 %                                                                             %
    902 %   M a g i c k S e t I t e r a t o r I n d e x                               %
    903 %                                                                             %
    904 %                                                                             %
    905 %                                                                             %
    906 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    907 %
    908 %  MagickSetIteratorIndex() set the iterator to the given position in the
    909 %  image list specified with the index parameter.  A zero index will set
    910 %  the first image as current, and so on.  Negative indexes can be used
    911 %  to specify an image relative to the end of the images in the wand, with
    912 %  -1 being the last image in the wand.
    913 %
    914 %  If the index is invalid (range too large for number of images in wand)
    915 %  the function will return MagickFalse, but no 'exception' will be raised,
    916 %  as it is not actually an error.  In that case the current image will not
    917 %  change.
    918 %
    919 %  After using any images added to the wand using MagickAddImage() or
    920 %  MagickReadImage() will be added after the image indexed, regardless
    921 %  of if a zero (first image in list) or negative index (from end) is used.
    922 %
    923 %  Jumping to index 0 is similar to MagickResetIterator() but differs in how
    924 %  MagickNextImage() behaves afterward.
    925 %
    926 %  The format of the MagickSetIteratorIndex method is:
    927 %
    928 %      MagickBooleanType MagickSetIteratorIndex(MagickWand *wand,
    929 %        const ssize_t index)
    930 %
    931 %  A description of each parameter follows:
    932 %
    933 %    o wand: the magick wand.
    934 %
    935 %    o index: the scene number.
    936 %
    937 */
    938 WandExport MagickBooleanType MagickSetIteratorIndex(MagickWand *wand,
    939   const ssize_t index)
    940 {
    941   Image
    942     *image;
    943 
    944   assert(wand != (MagickWand *) NULL);
    945   assert(wand->signature == MagickWandSignature);
    946   if (wand->debug != MagickFalse)
    947     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    948   if (wand->images == (Image *) NULL)
    949     return(MagickFalse);
    950   image=GetImageFromList(wand->images,index);
    951   if (image == (Image *) NULL)
    952     return(MagickFalse);    /* this is not an exception! Just range error. */
    953   wand->images=image;
    954   wand->insert_before=MagickFalse;  /* Insert/Add after (this) image */
    955   wand->image_pending=MagickFalse;  /* NextImage will set next image */
    956   return(MagickTrue);
    957 }
    958 /*
    959 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    960 %                                                                             %
    961 %                                                                             %
    962 %                                                                             %
    963 %   M a g i c k S e t L a s t I t e r a t o r                                 %
    964 %                                                                             %
    965 %                                                                             %
    966 %                                                                             %
    967 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    968 %
    969 %  MagickSetLastIterator() sets the wand iterator to the last image.
    970 %
    971 %  The last image is actually the current image, and the next use of
    972 %  MagickPreviousImage() will not change this allowing this function to be
    973 %  used to iterate over the images in the reverse direction. In this sense it
    974 %  is more like  MagickResetIterator() than MagickSetFirstIterator().
    975 %
    976 %  Typically this function is used before MagickAddImage(), MagickReadImage()
    977 %  functions to ensure new images are appended to the very end of wand's image
    978 %  list.
    979 %
    980 %  The format of the MagickSetLastIterator method is:
    981 %
    982 %      void MagickSetLastIterator(MagickWand *wand)
    983 %
    984 %  A description of each parameter follows:
    985 %
    986 %    o wand: the magick wand.
    987 %
    988 */
    989 WandExport void MagickSetLastIterator(MagickWand *wand)
    990 {
    991   assert(wand != (MagickWand *) NULL);
    992   assert(wand->signature == MagickWandSignature);
    993   if (wand->debug != MagickFalse)
    994     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    995   wand->images=GetLastImageInList(wand->images);
    996   wand->insert_before=MagickFalse;  /* Insert/add after current (last) image */
    997   wand->image_pending=MagickTrue;   /* PreviousImage will return last image */
    998 }
    999 
   1000 /*
   1002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1003 %                                                                             %
   1004 %                                                                             %
   1005 %                                                                             %
   1006 %   M a g i c k W a n d G e n e s i s                                         %
   1007 %                                                                             %
   1008 %                                                                             %
   1009 %                                                                             %
   1010 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1011 %
   1012 %  MagickWandGenesis() initializes the MagickWand environment.
   1013 %
   1014 %  The format of the MagickWandGenesis method is:
   1015 %
   1016 %      void MagickWandGenesis(void)
   1017 %
   1018 */
   1019 WandExport void MagickWandGenesis(void)
   1020 {
   1021   if (IsMagickCoreInstantiated() == MagickFalse)
   1022     MagickCoreGenesis((char *) NULL,MagickFalse);
   1023 }
   1024 
   1025 /*
   1027 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1028 %                                                                             %
   1029 %                                                                             %
   1030 %                                                                             %
   1031 %   M a g i c k W a n d T e r m i n u s                                       %
   1032 %                                                                             %
   1033 %                                                                             %
   1034 %                                                                             %
   1035 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1036 %
   1037 %  MagickWandTerminus() terminates the MagickWand environment.
   1038 %
   1039 %  The format of the MaickWandTerminus method is:
   1040 %
   1041 %      void MagickWandTerminus(void)
   1042 %
   1043 */
   1044 WandExport void MagickWandTerminus(void)
   1045 {
   1046   DestroyWandIds();
   1047   MagickCoreTerminus();
   1048 }
   1049 
   1050 /*
   1052 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1053 %                                                                             %
   1054 %                                                                             %
   1055 %                                                                             %
   1056 %   N e w M a g i c k W a n d                                                 %
   1057 %                                                                             %
   1058 %                                                                             %
   1059 %                                                                             %
   1060 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1061 %
   1062 %  NewMagickWand() returns a wand required for all other methods in the API.
   1063 %  A fatal exception is thrown if there is not enough memory to allocate the
   1064 %  wand.   Use DestroyMagickWand() to dispose of the wand when it is no longer
   1065 %  needed.
   1066 %
   1067 %  The format of the NewMagickWand method is:
   1068 %
   1069 %      MagickWand *NewMagickWand(void)
   1070 %
   1071 */
   1072 WandExport MagickWand *NewMagickWand(void)
   1073 {
   1074   const char
   1075     *quantum;
   1076 
   1077   MagickWand
   1078     *wand;
   1079 
   1080   size_t
   1081     depth;
   1082 
   1083   depth=MAGICKCORE_QUANTUM_DEPTH;
   1084   quantum=GetMagickQuantumDepth(&depth);
   1085   if (depth != MAGICKCORE_QUANTUM_DEPTH)
   1086     ThrowWandFatalException(WandError,"QuantumDepthMismatch",quantum);
   1087   wand=(MagickWand *) AcquireMagickMemory(sizeof(*wand));
   1088   if (wand == (MagickWand *) NULL)
   1089     ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
   1090       GetExceptionMessage(errno));
   1091   (void) ResetMagickMemory(wand,0,sizeof(*wand));
   1092   wand->id=AcquireWandId();
   1093   (void) FormatLocaleString(wand->name,MagickPathExtent,"%s-%.20g",MagickWandId,
   1094     (double) wand->id);
   1095   wand->images=NewImageList();
   1096   wand->image_info=AcquireImageInfo();
   1097   wand->exception=AcquireExceptionInfo();
   1098   wand->debug=IsEventLogging();
   1099   if (wand->debug != MagickFalse)
   1100     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1101   wand->signature=MagickWandSignature;
   1102   return(wand);
   1103 }
   1104 
   1105 /*
   1107 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1108 %                                                                             %
   1109 %                                                                             %
   1110 %                                                                             %
   1111 %   N e w M a g i c k W a n d F r o m I m a g e                               %
   1112 %                                                                             %
   1113 %                                                                             %
   1114 %                                                                             %
   1115 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1116 %
   1117 %  NewMagickWandFromImage() returns a wand with an image.
   1118 %
   1119 %  The format of the NewMagickWandFromImage method is:
   1120 %
   1121 %      MagickWand *NewMagickWandFromImage(const Image *image)
   1122 %
   1123 %  A description of each parameter follows:
   1124 %
   1125 %    o image: the image.
   1126 %
   1127 */
   1128 WandExport MagickWand *NewMagickWandFromImage(const Image *image)
   1129 {
   1130   MagickWand
   1131     *wand;
   1132 
   1133   wand=NewMagickWand();
   1134   wand->images=CloneImage(image,0,0,MagickTrue,wand->exception);
   1135   return(wand);
   1136 }
   1137 
   1138 /*
   1140 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1141 %                                                                             %
   1142 %                                                                             %
   1143 %                                                                             %
   1144 %  I s M a g i c k W a n d I n s t a n t i a t e d                            %
   1145 %                                                                             %
   1146 %                                                                             %
   1147 %                                                                             %
   1148 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1149 %
   1150 %  IsMagickWandInstantiated() returns MagickTrue if the ImageMagick environment
   1151 %  is currently instantiated--  that is, MagickWandGenesis() has been called but
   1152 %  MagickWandTerminus() has not.
   1153 %
   1154 %  The format of the IsMagickWandInstantiated method is:
   1155 %
   1156 %      MagickBooleanType IsMagickWandInstantiated(void)
   1157 %
   1158 */
   1159 MagickExport MagickBooleanType IsMagickWandInstantiated(void)
   1160 {
   1161   return(IsMagickCoreInstantiated());
   1162 }
   1163