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-2019 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 %    https://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) memset(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=(char *) NULL;
    430   if (number_options != 0)
    431     value=AcquireString(configure_info[0]->value);
    432   configure_info=(const ConfigureInfo **)
    433     RelinquishMagickMemory((void *) configure_info);
    434   return(value);
    435 }
    436 
    437 /*
    439 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    440 %                                                                             %
    441 %                                                                             %
    442 %                                                                             %
    443 %   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                     %
    444 %                                                                             %
    445 %                                                                             %
    446 %                                                                             %
    447 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    448 %
    449 %  MagickQueryConfigureOptions() returns any configure options that match the
    450 %  specified pattern (e.g.  "*" for all).  Options include NAME, VERSION,
    451 %  LIB_VERSION, etc.
    452 %
    453 %  The format of the MagickQueryConfigureOptions function is:
    454 %
    455 %      char **MagickQueryConfigureOptions(const char *pattern,
    456 %        size_t *number_options)
    457 %
    458 %  A description of each parameter follows:
    459 %
    460 %    o pattern: Specifies a pointer to a text string containing a pattern.
    461 %
    462 %    o number_options:  Returns the number of configure options in the list.
    463 %
    464 %
    465 */
    466 WandExport char **MagickQueryConfigureOptions(const char *pattern,
    467   size_t *number_options)
    468 {
    469   char
    470     **options;
    471 
    472   ExceptionInfo
    473     *exception;
    474 
    475   exception=AcquireExceptionInfo();
    476   options=GetConfigureList(pattern,number_options,exception);
    477   exception=DestroyExceptionInfo(exception);
    478   return(options);
    479 }
    480 
    481 /*
    483 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    484 %                                                                             %
    485 %                                                                             %
    486 %                                                                             %
    487 %   M a g i c k Q u e r y F o n t M e t r i c s                               %
    488 %                                                                             %
    489 %                                                                             %
    490 %                                                                             %
    491 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    492 %
    493 %  MagickQueryFontMetrics() returns a 13 element array representing the
    494 %  following font metrics:
    495 %
    496 %    Element Description
    497 %    -------------------------------------------------
    498 %          0 character width
    499 %          1 character height
    500 %          2 ascender
    501 %          3 descender
    502 %          4 text width
    503 %          5 text height
    504 %          6 maximum horizontal advance
    505 %          7 bounding box: x1
    506 %          8 bounding box: y1
    507 %          9 bounding box: x2
    508 %         10 bounding box: y2
    509 %         11 origin: x
    510 %         12 origin: y
    511 %
    512 %  The format of the MagickQueryFontMetrics method is:
    513 %
    514 %      double *MagickQueryFontMetrics(MagickWand *wand,
    515 %        const DrawingWand *drawing_wand,const char *text)
    516 %
    517 %  A description of each parameter follows:
    518 %
    519 %    o wand: the Magick wand.
    520 %
    521 %    o drawing_wand: the drawing wand.
    522 %
    523 %    o text: the text.
    524 %
    525 */
    526 WandExport double *MagickQueryFontMetrics(MagickWand *wand,
    527   const DrawingWand *drawing_wand,const char *text)
    528 {
    529   double
    530     *font_metrics;
    531 
    532   DrawInfo
    533     *draw_info;
    534 
    535   MagickBooleanType
    536     status;
    537 
    538   TypeMetric
    539     metrics;
    540 
    541   assert(wand != (MagickWand *) NULL);
    542   assert(wand->signature == MagickWandSignature);
    543   if (wand->debug != MagickFalse)
    544     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    545   assert(drawing_wand != (const DrawingWand *) NULL);
    546   if (wand->images == (Image *) NULL)
    547     {
    548       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
    549         "ContainsNoImages","`%s'",wand->name);
    550       return((double *) NULL);
    551     }
    552   font_metrics=(double *) AcquireQuantumMemory(13UL,sizeof(*font_metrics));
    553   if (font_metrics == (double *) NULL)
    554     return((double *) NULL);
    555   draw_info=PeekDrawingWand(drawing_wand);
    556   if (draw_info == (DrawInfo *) NULL)
    557     {
    558       font_metrics=(double *) RelinquishMagickMemory(font_metrics);
    559       return((double *) NULL);
    560     }
    561   (void) CloneString(&draw_info->text,text);
    562   (void) memset(&metrics,0,sizeof(metrics));
    563   status=GetTypeMetrics(wand->images,draw_info,&metrics,wand->exception);
    564   draw_info=DestroyDrawInfo(draw_info);
    565   if (status == MagickFalse)
    566     {
    567       font_metrics=(double *) RelinquishMagickMemory(font_metrics);
    568       return((double *) NULL);
    569     }
    570   font_metrics[0]=metrics.pixels_per_em.x;
    571   font_metrics[1]=metrics.pixels_per_em.y;
    572   font_metrics[2]=metrics.ascent;
    573   font_metrics[3]=metrics.descent;
    574   font_metrics[4]=metrics.width;
    575   font_metrics[5]=metrics.height;
    576   font_metrics[6]=metrics.max_advance;
    577   font_metrics[7]=metrics.bounds.x1;
    578   font_metrics[8]=metrics.bounds.y1;
    579   font_metrics[9]=metrics.bounds.x2;
    580   font_metrics[10]=metrics.bounds.y2;
    581   font_metrics[11]=metrics.origin.x;
    582   font_metrics[12]=metrics.origin.y;
    583   return(font_metrics);
    584 }
    585 
    586 /*
    588 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    589 %                                                                             %
    590 %                                                                             %
    591 %                                                                             %
    592 %   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             %
    593 %                                                                             %
    594 %                                                                             %
    595 %                                                                             %
    596 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    597 %
    598 %  MagickQueryMultilineFontMetrics() returns a 13 element array representing the
    599 %  following font metrics:
    600 %
    601 %    Element Description
    602 %    -------------------------------------------------
    603 %          0 character width
    604 %          1 character height
    605 %          2 ascender
    606 %          3 descender
    607 %          4 text width
    608 %          5 text height
    609 %          6 maximum horizontal advance
    610 %          7 bounding box: x1
    611 %          8 bounding box: y1
    612 %          9 bounding box: x2
    613 %         10 bounding box: y2
    614 %         11 origin: x
    615 %         12 origin: y
    616 %
    617 %  This method is like MagickQueryFontMetrics() but it returns the maximum text
    618 %  width and height for multiple lines of text.
    619 %
    620 %  The format of the MagickQueryFontMetrics method is:
    621 %
    622 %      double *MagickQueryMultilineFontMetrics(MagickWand *wand,
    623 %        const DrawingWand *drawing_wand,const char *text)
    624 %
    625 %  A description of each parameter follows:
    626 %
    627 %    o wand: the Magick wand.
    628 %
    629 %    o drawing_wand: the drawing wand.
    630 %
    631 %    o text: the text.
    632 %
    633 */
    634 WandExport double *MagickQueryMultilineFontMetrics(MagickWand *wand,
    635   const DrawingWand *drawing_wand,const char *text)
    636 {
    637   double
    638     *font_metrics;
    639 
    640   DrawInfo
    641     *draw_info;
    642 
    643   MagickBooleanType
    644     status;
    645 
    646   TypeMetric
    647     metrics;
    648 
    649   assert(wand != (MagickWand *) NULL);
    650   assert(wand->signature == MagickWandSignature);
    651   if (wand->debug != MagickFalse)
    652     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    653   assert(drawing_wand != (const DrawingWand *) NULL);
    654   if (wand->images == (Image *) NULL)
    655     {
    656       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
    657         "ContainsNoImages","`%s'",wand->name);
    658       return((double *) NULL);
    659     }
    660   font_metrics=(double *) AcquireQuantumMemory(13UL,sizeof(*font_metrics));
    661   if (font_metrics == (double *) NULL)
    662     return((double *) NULL);
    663   draw_info=PeekDrawingWand(drawing_wand);
    664   if (draw_info == (DrawInfo *) NULL)
    665     {
    666       font_metrics=(double *) RelinquishMagickMemory(font_metrics);
    667       return((double *) NULL);
    668     }
    669   (void) CloneString(&draw_info->text,text);
    670   (void) memset(&metrics,0,sizeof(metrics));
    671   status=GetMultilineTypeMetrics(wand->images,draw_info,&metrics,
    672     wand->exception);
    673   draw_info=DestroyDrawInfo(draw_info);
    674   if (status == MagickFalse)
    675     {
    676       font_metrics=(double *) RelinquishMagickMemory(font_metrics);
    677       return((double *) NULL);
    678     }
    679   font_metrics[0]=metrics.pixels_per_em.x;
    680   font_metrics[1]=metrics.pixels_per_em.y;
    681   font_metrics[2]=metrics.ascent;
    682   font_metrics[3]=metrics.descent;
    683   font_metrics[4]=metrics.width;
    684   font_metrics[5]=metrics.height;
    685   font_metrics[6]=metrics.max_advance;
    686   font_metrics[7]=metrics.bounds.x1;
    687   font_metrics[8]=metrics.bounds.y1;
    688   font_metrics[9]=metrics.bounds.x2;
    689   font_metrics[10]=metrics.bounds.y2;
    690   font_metrics[11]=metrics.origin.x;
    691   font_metrics[12]=metrics.origin.y;
    692   return(font_metrics);
    693 }
    694 
    695 /*
    697 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    698 %                                                                             %
    699 %                                                                             %
    700 %                                                                             %
    701 %   M a g i c k Q u e r y F o n t s                                           %
    702 %                                                                             %
    703 %                                                                             %
    704 %                                                                             %
    705 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    706 %
    707 %  MagickQueryFonts() returns any font that match the specified pattern (e.g.
    708 %  "*" for all).
    709 %
    710 %  The format of the MagickQueryFonts function is:
    711 %
    712 %      char **MagickQueryFonts(const char *pattern,size_t *number_fonts)
    713 %
    714 %  A description of each parameter follows:
    715 %
    716 %    o pattern: Specifies a pointer to a text string containing a pattern.
    717 %
    718 %    o number_fonts:  Returns the number of fonts in the list.
    719 %
    720 %
    721 */
    722 WandExport char **MagickQueryFonts(const char *pattern,
    723   size_t *number_fonts)
    724 {
    725   char
    726     **fonts;
    727 
    728   ExceptionInfo
    729     *exception;
    730 
    731   exception=AcquireExceptionInfo();
    732   fonts=GetTypeList(pattern,number_fonts,exception);
    733   exception=DestroyExceptionInfo(exception);
    734   return(fonts);
    735 }
    736 
    737 /*
    739 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    740 %                                                                             %
    741 %                                                                             %
    742 %                                                                             %
    743 %   M a g i c k Q u e r y F o r m a t s                                       %
    744 %                                                                             %
    745 %                                                                             %
    746 %                                                                             %
    747 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    748 %
    749 %  MagickQueryFormats() returns any image formats that match the specified
    750 %  pattern (e.g.  "*" for all).
    751 %
    752 %  The format of the MagickQueryFormats function is:
    753 %
    754 %      char **MagickQueryFormats(const char *pattern,size_t *number_formats)
    755 %
    756 %  A description of each parameter follows:
    757 %
    758 %    o pattern: Specifies a pointer to a text string containing a pattern.
    759 %
    760 %    o number_formats:  This integer returns the number of image formats in the
    761 %      list.
    762 %
    763 */
    764 WandExport char **MagickQueryFormats(const char *pattern,
    765   size_t *number_formats)
    766 {
    767   char
    768     **formats;
    769 
    770   ExceptionInfo
    771     *exception;
    772 
    773   exception=AcquireExceptionInfo();
    774   formats=GetMagickList(pattern,number_formats,exception);
    775   exception=DestroyExceptionInfo(exception);
    776   return(formats);
    777 }
    778 
    779 /*
    781 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    782 %                                                                             %
    783 %                                                                             %
    784 %                                                                             %
    785 %   M a g i c k R e l i n q u i s h M e m o r y                               %
    786 %                                                                             %
    787 %                                                                             %
    788 %                                                                             %
    789 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    790 %
    791 %  MagickRelinquishMemory() relinquishes memory resources returned by such
    792 %  methods as MagickIdentifyImage(), MagickGetException(), etc.
    793 %
    794 %  The format of the MagickRelinquishMemory method is:
    795 %
    796 %      void *MagickRelinquishMemory(void *resource)
    797 %
    798 %  A description of each parameter follows:
    799 %
    800 %    o resource: Relinquish the memory associated with this resource.
    801 %
    802 */
    803 WandExport void *MagickRelinquishMemory(void *memory)
    804 {
    805   (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
    806   return(RelinquishMagickMemory(memory));
    807 }
    808 
    809 /*
    811 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    812 %                                                                             %
    813 %                                                                             %
    814 %                                                                             %
    815 %   M a g i c k R e s e t I t e r a t o r                                     %
    816 %                                                                             %
    817 %                                                                             %
    818 %                                                                             %
    819 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    820 %
    821 %  MagickResetIterator() resets the wand iterator.
    822 %
    823 %  It is typically used either before iterating though images, or before
    824 %  calling specific functions such as  MagickAppendImages() to append all
    825 %  images together.
    826 %
    827 %  Afterward you can use MagickNextImage() to iterate over all the images
    828 %  in a wand container, starting with the first image.
    829 %
    830 %  Using this before MagickAddImages() or MagickReadImages() will cause
    831 %  new images to be inserted between the first and second image.
    832 %
    833 %  The format of the MagickResetIterator method is:
    834 %
    835 %      void MagickResetIterator(MagickWand *wand)
    836 %
    837 %  A description of each parameter follows:
    838 %
    839 %    o wand: the magick wand.
    840 %
    841 */
    842 WandExport void MagickResetIterator(MagickWand *wand)
    843 {
    844   assert(wand != (MagickWand *) NULL);
    845   assert(wand->signature == MagickWandSignature);
    846   if (wand->debug != MagickFalse)
    847     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    848   wand->images=GetFirstImageInList(wand->images);
    849   wand->insert_before=MagickFalse; /* Insert/add after current (first) image */
    850   wand->image_pending=MagickTrue;  /* NextImage will set first image */
    851 }
    852 
    853 /*
    855 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    856 %                                                                             %
    857 %                                                                             %
    858 %                                                                             %
    859 %   M a g i c k S e t F i r s t I t e r a t o r                               %
    860 %                                                                             %
    861 %                                                                             %
    862 %                                                                             %
    863 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    864 %
    865 %  MagickSetFirstIterator() sets the wand iterator to the first image.
    866 %
    867 %  After using any images added to the wand using MagickAddImage() or
    868 %  MagickReadImage() will be prepended before any image in the wand.
    869 %
    870 %  Also the current image has been set to the first image (if any) in the
    871 %  Magick Wand.  Using MagickNextImage() will then set teh current image
    872 %  to the second image in the list (if present).
    873 %
    874 %  This operation is similar to MagickResetIterator() but differs in how
    875 %  MagickAddImage(), MagickReadImage(), and MagickNextImage() behaves
    876 %  afterward.
    877 %
    878 %  The format of the MagickSetFirstIterator method is:
    879 %
    880 %      void MagickSetFirstIterator(MagickWand *wand)
    881 %
    882 %  A description of each parameter follows:
    883 %
    884 %    o wand: the magick wand.
    885 %
    886 */
    887 WandExport void MagickSetFirstIterator(MagickWand *wand)
    888 {
    889   assert(wand != (MagickWand *) NULL);
    890   assert(wand->signature == MagickWandSignature);
    891   if (wand->debug != MagickFalse)
    892     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    893   wand->images=GetFirstImageInList(wand->images);
    894   wand->insert_before=MagickTrue;   /* Insert/add before the first image */
    895   wand->image_pending=MagickFalse;  /* NextImage will set next image */
    896 }
    897 
    898 /*
    900 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    901 %                                                                             %
    902 %                                                                             %
    903 %                                                                             %
    904 %   M a g i c k S e t I t e r a t o r I n d e x                               %
    905 %                                                                             %
    906 %                                                                             %
    907 %                                                                             %
    908 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    909 %
    910 %  MagickSetIteratorIndex() set the iterator to the given position in the
    911 %  image list specified with the index parameter.  A zero index will set
    912 %  the first image as current, and so on.  Negative indexes can be used
    913 %  to specify an image relative to the end of the images in the wand, with
    914 %  -1 being the last image in the wand.
    915 %
    916 %  If the index is invalid (range too large for number of images in wand)
    917 %  the function will return MagickFalse, but no 'exception' will be raised,
    918 %  as it is not actually an error.  In that case the current image will not
    919 %  change.
    920 %
    921 %  After using any images added to the wand using MagickAddImage() or
    922 %  MagickReadImage() will be added after the image indexed, regardless
    923 %  of if a zero (first image in list) or negative index (from end) is used.
    924 %
    925 %  Jumping to index 0 is similar to MagickResetIterator() but differs in how
    926 %  MagickNextImage() behaves afterward.
    927 %
    928 %  The format of the MagickSetIteratorIndex method is:
    929 %
    930 %      MagickBooleanType MagickSetIteratorIndex(MagickWand *wand,
    931 %        const ssize_t index)
    932 %
    933 %  A description of each parameter follows:
    934 %
    935 %    o wand: the magick wand.
    936 %
    937 %    o index: the scene number.
    938 %
    939 */
    940 WandExport MagickBooleanType MagickSetIteratorIndex(MagickWand *wand,
    941   const ssize_t index)
    942 {
    943   Image
    944     *image;
    945 
    946   assert(wand != (MagickWand *) NULL);
    947   assert(wand->signature == MagickWandSignature);
    948   if (wand->debug != MagickFalse)
    949     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    950   if (wand->images == (Image *) NULL)
    951     return(MagickFalse);
    952   image=GetImageFromList(wand->images,index);
    953   if (image == (Image *) NULL)
    954     return(MagickFalse);    /* this is not an exception! Just range error. */
    955   wand->images=image;
    956   wand->insert_before=MagickFalse;  /* Insert/Add after (this) image */
    957   wand->image_pending=MagickFalse;  /* NextImage will set next image */
    958   return(MagickTrue);
    959 }
    960 /*
    961 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    962 %                                                                             %
    963 %                                                                             %
    964 %                                                                             %
    965 %   M a g i c k S e t L a s t I t e r a t o r                                 %
    966 %                                                                             %
    967 %                                                                             %
    968 %                                                                             %
    969 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    970 %
    971 %  MagickSetLastIterator() sets the wand iterator to the last image.
    972 %
    973 %  The last image is actually the current image, and the next use of
    974 %  MagickPreviousImage() will not change this allowing this function to be
    975 %  used to iterate over the images in the reverse direction. In this sense it
    976 %  is more like  MagickResetIterator() than MagickSetFirstIterator().
    977 %
    978 %  Typically this function is used before MagickAddImage(), MagickReadImage()
    979 %  functions to ensure new images are appended to the very end of wand's image
    980 %  list.
    981 %
    982 %  The format of the MagickSetLastIterator method is:
    983 %
    984 %      void MagickSetLastIterator(MagickWand *wand)
    985 %
    986 %  A description of each parameter follows:
    987 %
    988 %    o wand: the magick wand.
    989 %
    990 */
    991 WandExport void MagickSetLastIterator(MagickWand *wand)
    992 {
    993   assert(wand != (MagickWand *) NULL);
    994   assert(wand->signature == MagickWandSignature);
    995   if (wand->debug != MagickFalse)
    996     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    997   wand->images=GetLastImageInList(wand->images);
    998   wand->insert_before=MagickFalse;  /* Insert/add after current (last) image */
    999   wand->image_pending=MagickTrue;   /* PreviousImage will return last image */
   1000 }
   1001 
   1002 /*
   1004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1005 %                                                                             %
   1006 %                                                                             %
   1007 %                                                                             %
   1008 %   M a g i c k W a n d G e n e s i s                                         %
   1009 %                                                                             %
   1010 %                                                                             %
   1011 %                                                                             %
   1012 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1013 %
   1014 %  MagickWandGenesis() initializes the MagickWand environment.
   1015 %
   1016 %  The format of the MagickWandGenesis method is:
   1017 %
   1018 %      void MagickWandGenesis(void)
   1019 %
   1020 */
   1021 WandExport void MagickWandGenesis(void)
   1022 {
   1023   if (IsMagickCoreInstantiated() == MagickFalse)
   1024     MagickCoreGenesis((char *) NULL,MagickFalse);
   1025 }
   1026 
   1027 /*
   1029 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1030 %                                                                             %
   1031 %                                                                             %
   1032 %                                                                             %
   1033 %   M a g i c k W a n d T e r m i n u s                                       %
   1034 %                                                                             %
   1035 %                                                                             %
   1036 %                                                                             %
   1037 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1038 %
   1039 %  MagickWandTerminus() terminates the MagickWand environment.
   1040 %
   1041 %  The format of the MaickWandTerminus method is:
   1042 %
   1043 %      void MagickWandTerminus(void)
   1044 %
   1045 */
   1046 WandExport void MagickWandTerminus(void)
   1047 {
   1048   DestroyWandIds();
   1049   MagickCoreTerminus();
   1050 }
   1051 
   1052 /*
   1054 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1055 %                                                                             %
   1056 %                                                                             %
   1057 %                                                                             %
   1058 %   N e w M a g i c k W a n d                                                 %
   1059 %                                                                             %
   1060 %                                                                             %
   1061 %                                                                             %
   1062 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1063 %
   1064 %  NewMagickWand() returns a wand required for all other methods in the API.
   1065 %  A fatal exception is thrown if there is not enough memory to allocate the
   1066 %  wand.   Use DestroyMagickWand() to dispose of the wand when it is no longer
   1067 %  needed.
   1068 %
   1069 %  The format of the NewMagickWand method is:
   1070 %
   1071 %      MagickWand *NewMagickWand(void)
   1072 %
   1073 */
   1074 WandExport MagickWand *NewMagickWand(void)
   1075 {
   1076   const char
   1077     *quantum;
   1078 
   1079   MagickWand
   1080     *wand;
   1081 
   1082   size_t
   1083     depth;
   1084 
   1085   depth=MAGICKCORE_QUANTUM_DEPTH;
   1086   quantum=GetMagickQuantumDepth(&depth);
   1087   if (depth != MAGICKCORE_QUANTUM_DEPTH)
   1088     ThrowWandFatalException(WandError,"QuantumDepthMismatch",quantum);
   1089   wand=(MagickWand *) AcquireMagickMemory(sizeof(*wand));
   1090   if (wand == (MagickWand *) NULL)
   1091     ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
   1092       GetExceptionMessage(errno));
   1093   (void) memset(wand,0,sizeof(*wand));
   1094   wand->id=AcquireWandId();
   1095   (void) FormatLocaleString(wand->name,MagickPathExtent,"%s-%.20g",MagickWandId,
   1096     (double) wand->id);
   1097   wand->images=NewImageList();
   1098   wand->image_info=AcquireImageInfo();
   1099   wand->exception=AcquireExceptionInfo();
   1100   wand->debug=IsEventLogging();
   1101   if (wand->debug != MagickFalse)
   1102     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1103   wand->signature=MagickWandSignature;
   1104   return(wand);
   1105 }
   1106 
   1107 /*
   1109 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1110 %                                                                             %
   1111 %                                                                             %
   1112 %                                                                             %
   1113 %   N e w M a g i c k W a n d F r o m I m a g e                               %
   1114 %                                                                             %
   1115 %                                                                             %
   1116 %                                                                             %
   1117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1118 %
   1119 %  NewMagickWandFromImage() returns a wand with an image.
   1120 %
   1121 %  The format of the NewMagickWandFromImage method is:
   1122 %
   1123 %      MagickWand *NewMagickWandFromImage(const Image *image)
   1124 %
   1125 %  A description of each parameter follows:
   1126 %
   1127 %    o image: the image.
   1128 %
   1129 */
   1130 WandExport MagickWand *NewMagickWandFromImage(const Image *image)
   1131 {
   1132   MagickWand
   1133     *wand;
   1134 
   1135   wand=NewMagickWand();
   1136   wand->images=CloneImage(image,0,0,MagickTrue,wand->exception);
   1137   return(wand);
   1138 }
   1139 
   1140 /*
   1142 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1143 %                                                                             %
   1144 %                                                                             %
   1145 %                                                                             %
   1146 %  I s M a g i c k W a n d I n s t a n t i a t e d                            %
   1147 %                                                                             %
   1148 %                                                                             %
   1149 %                                                                             %
   1150 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1151 %
   1152 %  IsMagickWandInstantiated() returns MagickTrue if the ImageMagick environment
   1153 %  is currently instantiated--  that is, MagickWandGenesis() has been called but
   1154 %  MagickWandTerminus() has not.
   1155 %
   1156 %  The format of the IsMagickWandInstantiated method is:
   1157 %
   1158 %      MagickBooleanType IsMagickWandInstantiated(void)
   1159 %
   1160 */
   1161 MagickExport MagickBooleanType IsMagickWandInstantiated(void)
   1162 {
   1163   return(IsMagickCoreInstantiated());
   1164 }
   1165