animate.c

Go to the documentation of this file.
00001 /*
00002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00003 %                                                                             %
00004 %                                                                             %
00005 %                                                                             %
00006 %                AAA   N   N  IIIII  M   M   AAA   TTTTT  EEEEE               %
00007 %               A   A  NN  N    I    MM MM  A   A    T    E                   %
00008 %               AAAAA  N N N    I    M M M  AAAAA    T    EEE                 %
00009 %               A   A  N  NN    I    M   M  A   A    T    E                   %
00010 %               A   A  N   N  IIIII  M   M  A   A    T    EEEEE               %
00011 %                                                                             %
00012 %                                                                             %
00013 %              Methods to Interactively Animate an Image Sequence             %
00014 %                                                                             %
00015 %                             Software Design                                 %
00016 %                               John Cristy                                   %
00017 %                                July 1992                                    %
00018 %                                                                             %
00019 %                                                                             %
00020 %  Copyright 1999-2009 ImageMagick Studio LLC, a non-profit organization      %
00021 %  dedicated to making software imaging solutions freely available.           %
00022 %                                                                             %
00023 %  You may not use this file except in compliance with the License.  You may  %
00024 %  obtain a copy of the License at                                            %
00025 %                                                                             %
00026 %    http://www.imagemagick.org/script/license.php                            %
00027 %                                                                             %
00028 %  Unless required by applicable law or agreed to in writing, software        %
00029 %  distributed under the License is distributed on an "AS IS" BASIS,          %
00030 %  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
00031 %  See the License for the specific language governing permissions and        %
00032 %  limitations under the License.                                             %
00033 %                                                                             %
00034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00035 %
00036 %  Use the animate program to animate an image sequence on any X server.
00037 %
00038 */
00039 
00040 /*
00041   Include declarations.
00042 */
00043 #include "wand/studio.h"
00044 #include "wand/MagickWand.h"
00045 #include "wand/mogrify-private.h"
00046 #include "magick/animate-private.h"
00047 
00048 /*
00049 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00050 %                                                                             %
00051 %                                                                             %
00052 %                                                                             %
00053 +   A n i m a t e I m a g e C o m m a n d                                     %
00054 %                                                                             %
00055 %                                                                             %
00056 %                                                                             %
00057 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00058 %
00059 %  AnimateImageCommand() displays a sequence of images on any workstation
00060 %  display running an X server. Animate first determines the hardware
00061 %  capabilities of the workstation. If the number of unique colors in an image
00062 %  is less than or equal to the number the workstation can support, the image
00063 %  is displayed in an X window. Otherwise the number of colors in the image is
00064 %  first reduced to match the color resolution of the workstation before it is
00065 %  displayed.
00066 %
00067 %  This means that a continuous-tone 24 bits/pixel image can display on a 8
00068 %  bit pseudo-color device or monochrome device. In most instances the reduced
00069 %  color image closely resembles the original. Alternatively, a monochrome or
00070 %  pseudo-color image sequence can display on a continuous-tone 24 bits/pixels
00071 %  device.
00072 %
00073 %  The format of the AnimateImageCommand method is:
00074 %
00075 %      MagickBooleanType AnimateImageCommand(ImageInfo *image_info,int argc,
00076 %        char **argv,char **metadata,ExceptionInfo *exception)
00077 %
00078 %  A description of each parameter follows:
00079 %
00080 %    o image_info: the image info.
00081 %
00082 %    o argc: the number of elements in the argument vector.
00083 %
00084 %    o argv: A text array containing the command line arguments.
00085 %
00086 %    o metadata: any metadata is returned here.
00087 %
00088 %    o exception: return any errors or warnings in this structure.
00089 %
00090 */
00091 
00092 static MagickBooleanType AnimateUsage(void)
00093 {
00094   const char
00095     **p;
00096 
00097   static const char
00098     *buttons[]=
00099     {
00100       "Press any button to map or unmap the Command widget",
00101       (char *) NULL
00102     },
00103     *miscellaneous[]=
00104     {
00105       "-debug events        display copious debugging information",
00106       "-help                print program options",
00107       "-list type           print a list of supported option arguments",
00108       "-log format          format of debugging information",
00109       "-version             print version information",
00110       (char *) NULL
00111     },
00112     *operators[]=
00113     {
00114       "-colors value        preferred number of colors in the image",
00115       "-crop geometry       preferred size and location of the cropped image",
00116       "-extract geometry    extract area from image",
00117       "-monochrome          transform image to black and white",
00118       "-repage geometry     size and location of an image canvas (operator)",
00119       "-resample geometry   change the resolution of an image",
00120       "-resize geometry     resize the image",
00121       "-rotate degrees      apply Paeth rotation to the image",
00122       "-strip               strip image of all profiles and comments",
00123       "-trim                trim image edges",
00124       (char *) NULL
00125     },
00126     *settings[]=
00127     {
00128       "-alpha option        on, activate, off, deactivate, set, opaque, copy",
00129       "                     transparent, extract, background, or shape",
00130       "-authenticate password",
00131       "                     decipher image with this password",
00132       "-backdrop            display image centered on a backdrop",
00133       "-channel type        apply option to select image channels",
00134       "-colormap type       Shared or Private",
00135       "-colorspace type     alternate image colorspace",
00136       "-decipher filename   convert cipher pixels to plain pixels",
00137       "-define format:option",
00138       "                     define one or more image format options",
00139       "-delay value         display the next image after pausing",
00140       "-density geometry    horizontal and vertical density of the image",
00141       "-depth value         image depth",
00142       "-display server      display image to this X server",
00143       "-dispose method      layer disposal method",
00144       "-dither method       apply error diffusion to image",
00145       "-filter type         use this filter when resizing an image",
00146       "-format \"string\"     output formatted image characteristics",
00147       "-gamma value         level of gamma correction",
00148       "-geometry geometry   preferred size and location of the Image window",
00149       "-gravity type        horizontal and vertical backdrop placement",
00150       "-identify            identify the format and characteristics of the image",
00151       "-immutable           displayed image cannot be modified",
00152       "-interlace type      type of image interlacing scheme",
00153       "-interpolate method  pixel color interpolation method",
00154       "-limit type value    pixel cache resource limit",
00155       "-loop iterations     loop images then exit",
00156       "-map type            display image using this Standard Colormap",
00157       "-monitor             monitor progress",
00158       "-pause               seconds to pause before reanimating",
00159       "-page geometry       size and location of an image canvas (setting)",
00160       "-quantize colorspace reduce colors in this colorspace",
00161       "-quiet               suppress all warning messages",
00162       "-regard-warnings     pay attention to warning messages",
00163       "-remote command      execute a command in an remote display process",
00164       "-respect-parentheses settings remain in effect until parenthesis boundary",
00165       "-sampling-factor geometry",
00166       "                     horizontal and vertical sampling factor",
00167       "-seed value          seed a new sequence of pseudo-random numbers",
00168       "-set attribute value set an image attribute",
00169       "-size geometry       width and height of image",
00170       "-transparent-color color",
00171       "                     transparent color",
00172       "-treedepth value     color tree depth",
00173       "-verbose             print detailed information about the image",
00174       "-visual type         display image using this visual type",
00175       "-virtual-pixel method",
00176       "                     virtual pixel access method",
00177       "-window id           display image to background of this window",
00178       (char *) NULL
00179     },
00180     *sequence_operators[]=
00181     {
00182       "-coalesce            merge a sequence of images",
00183       "-flatten             flatten a sequence of images",
00184       (char *) NULL
00185     };
00186 
00187   (void) printf("Version: %s\n",GetMagickVersion((unsigned long *) NULL));
00188   (void) printf("Copyright: %s\n",GetMagickCopyright());
00189   (void) printf("Features: %s\n\n",GetMagickFeatures());
00190   (void) printf("Usage: %s [options ...] file [ [options ...] file ...]\n",
00191     GetClientName());
00192   (void) printf("\nImage Settings:\n");
00193   for (p=settings; *p != (char *) NULL; p++)
00194     (void) printf("  %s\n",*p);
00195   (void) printf("\nImage Operators:\n");
00196   for (p=operators; *p != (char *) NULL; p++)
00197     (void) printf("  %s\n",*p);
00198   (void) printf("\nImage Sequence Operators:\n");
00199   for (p=sequence_operators; *p != (char *) NULL; p++)
00200     (void) printf("  %s\n",*p);
00201   (void) printf("\nMiscellaneous Options:\n");
00202   for (p=miscellaneous; *p != (char *) NULL; p++)
00203     (void) printf("  %s\n",*p);
00204   (void) printf(
00205     "\nIn addition to those listed above, you can specify these standard X\n");
00206   (void) printf(
00207     "resources as command line options:  -background, -bordercolor,\n");
00208   (void) printf(
00209     "-borderwidth, -font, -foreground, -iconGeometry, -iconic, -name,\n");
00210   (void) printf("-mattecolor, -shared-memory, or -title.\n");
00211   (void) printf(
00212     "\nBy default, the image format of `file' is determined by its magic\n");
00213   (void) printf(
00214     "number.  To specify a particular image format, precede the filename\n");
00215   (void) printf(
00216     "with an image format name and a colon (i.e. ps:image) or specify the\n");
00217   (void) printf(
00218     "image type as the filename suffix (i.e. image.ps).  Specify 'file' as\n");
00219   (void) printf("'-' for standard input or output.\n");
00220   (void) printf("\nButtons: \n");
00221   for (p=buttons; *p != (char *) NULL; p++)
00222     (void) printf("  %s\n",*p);
00223   return(MagickFalse);
00224 }
00225 
00226 WandExport MagickBooleanType AnimateImageCommand(ImageInfo *image_info,
00227   int argc,char **argv,char **wand_unused(metadata),ExceptionInfo *exception)
00228 {
00229 #if defined(MAGICKCORE_X11_DELEGATE)
00230 #define DestroyAnimate() \
00231 { \
00232   XDestroyResourceInfo(&resource_info); \
00233   if (display != (Display *) NULL) \
00234     { \
00235       XCloseDisplay(display); \
00236       display=(Display *) NULL; \
00237     } \
00238   XDestroyResourceInfo(&resource_info); \
00239   DestroyImageStack(); \
00240   for (i=0; i < (long) argc; i++) \
00241     argv[i]=DestroyString(argv[i]); \
00242   argv=(char **) RelinquishMagickMemory(argv); \
00243 }
00244 #define ThrowAnimateException(asperity,tag,option) \
00245 { \
00246   (void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"`%s'", \
00247     option); \
00248   DestroyAnimate(); \
00249   return(MagickFalse); \
00250 }
00251 #define ThrowAnimateInvalidArgumentException(option,argument) \
00252 { \
00253   (void) ThrowMagickException(exception,GetMagickModule(),OptionError, \
00254     "InvalidArgument","`%s': %s",option,argument); \
00255   DestroyAnimate(); \
00256   return(MagickFalse); \
00257 }
00258 
00259   char
00260     *resource_value,
00261     *server_name;
00262 
00263   const char
00264     *option;
00265 
00266   Display
00267     *display;
00268 
00269   Image
00270     *image;
00271 
00272   ImageStack
00273     image_stack[MaxImageStackDepth+1];
00274 
00275   long
00276     j,
00277     k;
00278 
00279   MagickBooleanType
00280     fire,
00281     pend;
00282 
00283   MagickStatusType
00284     status;
00285 
00286   QuantizeInfo
00287     *quantize_info;
00288 
00289   register long
00290     i;
00291 
00292   XResourceInfo
00293     resource_info;
00294 
00295   XrmDatabase
00296     resource_database;
00297 
00298   /*
00299     Set defaults.
00300   */
00301   assert(image_info != (ImageInfo *) NULL);
00302   assert(image_info->signature == MagickSignature);
00303   if (image_info->debug != MagickFalse)
00304     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
00305   assert(exception != (ExceptionInfo *) NULL);
00306   if (argc == 2)
00307     {
00308       option=argv[1];
00309       if ((LocaleCompare("version",option+1) == 0) ||
00310           (LocaleCompare("-version",option+1) == 0))
00311         {
00312           (void) fprintf(stdout,"Version: %s\n",
00313             GetMagickVersion((unsigned long *) NULL));
00314           (void) fprintf(stdout,"Copyright: %s\n",GetMagickCopyright());
00315           (void) fprintf(stdout,"Features: %s\n\n",GetMagickFeatures());
00316           return(MagickFalse);
00317         }
00318     }
00319   status=MagickTrue;
00320   SetNotifyHandlers;
00321   display=(Display *) NULL;
00322   j=1;
00323   k=0;
00324   NewImageStack();
00325   option=(char *) NULL;
00326   pend=MagickFalse;
00327   resource_database=(XrmDatabase) NULL;
00328   (void) ResetMagickMemory(&resource_info,0,sizeof(XResourceInfo));
00329   server_name=(char *) NULL;
00330   status=MagickTrue;
00331   /*
00332     Check for server name specified on the command line.
00333   */
00334   ReadCommandlLine(argc,&argv);
00335   status=ExpandFilenames(&argc,&argv);
00336   if (status == MagickFalse)
00337     ThrowAnimateException(ResourceLimitError,"MemoryAllocationFailed",
00338       image_info->filename);
00339   for (i=1; i < (long) argc; i++)
00340   {
00341     /*
00342       Check command line for server name.
00343     */
00344     option=argv[i];
00345     if (LocaleCompare("display",option+1) == 0)
00346       {
00347         /*
00348           User specified server name.
00349         */
00350         i++;
00351         if (i == (long) argc)
00352           ThrowAnimateException(OptionError,"MissingArgument",option);
00353         server_name=argv[i];
00354       }
00355     if ((LocaleCompare("help",option+1) == 0) ||
00356         (LocaleCompare("-help",option+1) == 0))
00357       return(AnimateUsage());
00358   }
00359   /*
00360     Get user defaults from X resource database.
00361   */
00362   display=XOpenDisplay(server_name);
00363   if (display == (Display *) NULL)
00364     ThrowAnimateException(XServerError,"UnableToOpenXServer",
00365       XDisplayName(server_name));
00366   (void) XSetErrorHandler(XError);
00367   resource_database=XGetResourceDatabase(display,GetClientName());
00368   XGetResourceInfo(image_info,resource_database,GetClientName(),
00369     &resource_info);
00370   quantize_info=resource_info.quantize_info;
00371   image_info->density=XGetResourceInstance(resource_database,GetClientName(),
00372     "density",(char *) NULL);
00373   if (image_info->density == (char *) NULL)
00374     image_info->density=XGetScreenDensity(display);
00375   resource_value=XGetResourceInstance(resource_database,GetClientName(),
00376     "interlace","none");
00377   image_info->interlace=(InterlaceType)
00378     ParseMagickOption(MagickInterlaceOptions,MagickFalse,resource_value);
00379   resource_value=XGetResourceInstance(resource_database,GetClientName(),
00380     "verbose","False");
00381   image_info->verbose=IsMagickTrue(resource_value);
00382   resource_value=XGetResourceInstance(resource_database,GetClientName(),
00383     "dither","True");
00384   quantize_info->dither=IsMagickTrue(resource_value);
00385   /*
00386     Parse command line.
00387   */
00388   for (i=1; i <= (long) argc; i++)
00389   {
00390     if (i < (long) argc)
00391       option=argv[i];
00392     else
00393       if (image != (Image *) NULL)
00394         break;
00395       else
00396         if (isatty(STDIN_FILENO) != MagickFalse)
00397           option="logo:";
00398         else
00399           {
00400             int
00401               c;
00402 
00403             c=getc(stdin);
00404             if (c == EOF)
00405               option="logo:";
00406             else
00407               {
00408                 c=ungetc(c,stdin);
00409                 option="-";
00410               }
00411           }
00412     if (LocaleCompare(option,"(") == 0)
00413       {
00414         FireImageStack(MagickFalse,MagickTrue,pend);
00415         if (k == MaxImageStackDepth)
00416           ThrowAnimateException(OptionError,"ParenthesisNestedTooDeeply",
00417             option);
00418         PushImageStack();
00419         continue;
00420       }
00421     if (LocaleCompare(option,")") == 0)
00422       {
00423         FireImageStack(MagickFalse,MagickTrue,MagickTrue);
00424         if (k == 0)
00425           ThrowAnimateException(OptionError,"UnableToParseExpression",option);
00426         PopImageStack();
00427         continue;
00428       }
00429     if (IsMagickOption(option) == MagickFalse)
00430       {
00431         const char
00432           *filename;
00433 
00434         Image
00435           *images;
00436 
00437         /*
00438           Read input image.
00439         */
00440         FireImageStack(MagickFalse,MagickFalse,pend);
00441         filename=option;
00442         if ((LocaleCompare(filename,"--") == 0) && (i < (argc-1)))
00443           {
00444             option=argv[++i];
00445             filename=option;
00446           }
00447         (void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
00448         if (image_info->ping != MagickFalse)
00449           images=PingImages(image_info,exception);
00450         else
00451           images=ReadImages(image_info,exception);
00452         status&=(images != (Image *) NULL) &&
00453           (exception->severity < ErrorException);
00454         if (images == (Image *) NULL)
00455           continue;
00456         AppendImageStack(images);
00457         continue;
00458       }
00459     pend=image != (Image *) NULL ? MagickTrue : MagickFalse;
00460     switch (*(option+1))
00461     {
00462       case 'a':
00463       {
00464         if (LocaleCompare("alpha",option+1) == 0)
00465           {
00466             long
00467               type;
00468 
00469             if (*option == '+')
00470               break;
00471             i++;
00472             if (i == (long) argc)
00473               ThrowAnimateException(OptionError,"MissingArgument",option);
00474             type=ParseMagickOption(MagickAlphaOptions,MagickFalse,argv[i]);
00475             if (type < 0)
00476               ThrowAnimateException(OptionError,"UnrecognizedAlphaChannelType",
00477                 argv[i]);
00478             break;
00479           }
00480         if (LocaleCompare("authenticate",option+1) == 0)
00481           {
00482             if (*option == '+')
00483               break;
00484             i++;
00485             if (i == (long) argc)
00486               ThrowAnimateException(OptionError,"MissingArgument",option);
00487             break;
00488           }
00489         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
00490       }
00491       case 'b':
00492       {
00493         if (LocaleCompare("backdrop",option+1) == 0)
00494           {
00495             resource_info.backdrop=(*option == '-') ? MagickTrue : MagickFalse;
00496             break;
00497           }
00498         if (LocaleCompare("background",option+1) == 0)
00499           {
00500             if (*option == '+')
00501               break;
00502             i++;
00503             if (i == (long) argc)
00504               ThrowAnimateException(OptionError,"MissingArgument",option);
00505             resource_info.background_color=argv[i];
00506             break;
00507           }
00508         if (LocaleCompare("bordercolor",option+1) == 0)
00509           {
00510             if (*option == '+')
00511               break;
00512             i++;
00513             if (i == (long) argc)
00514               ThrowAnimateException(OptionError,"MissingArgument",option);
00515             resource_info.border_color=argv[i];
00516             break;
00517           }
00518         if (LocaleCompare("borderwidth",option+1) == 0)
00519           {
00520             resource_info.border_width=0;
00521             if (*option == '+')
00522               break;
00523             i++;
00524             if ((i == (long) argc) || (IsGeometry(argv[i]) == MagickFalse))
00525               ThrowAnimateException(OptionError,"MissingArgument",option);
00526             resource_info.border_width=(unsigned int) atoi(argv[i]);
00527             break;
00528           }
00529         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
00530       }
00531       case 'c':
00532       {
00533         if (LocaleCompare("cache",option+1) == 0)
00534           {
00535             if (*option == '+')
00536               break;
00537             i++;
00538             if (i == (long) argc)
00539               ThrowAnimateException(OptionError,"MissingArgument",option);
00540             if (IsGeometry(argv[i]) == MagickFalse)
00541               ThrowAnimateInvalidArgumentException(option,argv[i]);
00542             break;
00543           }
00544         if (LocaleCompare("channel",option+1) == 0)
00545           {
00546             long
00547               channel;
00548 
00549             if (*option == '+')
00550               break;
00551             i++;
00552             if (i == (long) (argc-1))
00553               ThrowAnimateException(OptionError,"MissingArgument",option);
00554             channel=ParseChannelOption(argv[i]);
00555             if (channel < 0)
00556               ThrowAnimateException(OptionError,"UnrecognizedChannelType",
00557                 argv[i]);
00558             break;
00559           }
00560         if (LocaleCompare("clone",option+1) == 0)
00561           {
00562             Image
00563               *clone_images;
00564 
00565             clone_images=image;
00566             if (k != 0)
00567               clone_images=image_stack[k-1].image;
00568             if (clone_images == (Image *) NULL)
00569               ThrowAnimateException(ImageError,"ImageSequenceRequired",option);
00570             FireImageStack(MagickFalse,MagickTrue,MagickTrue);
00571             if (*option == '+')
00572               clone_images=CloneImages(clone_images,"-1",exception);
00573             else
00574               {
00575                 i++;
00576                 if (i == (long) (argc-1))
00577                   ThrowAnimateException(OptionError,"MissingArgument",option);
00578                 if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse)
00579                   ThrowAnimateInvalidArgumentException(option,argv[i]);
00580                 clone_images=CloneImages(clone_images,argv[i],exception);
00581               }
00582             if (clone_images == (Image *) NULL)
00583               ThrowAnimateException(OptionError,"NoSuchImage",option);
00584             AppendImageStack(clone_images);
00585             break;
00586           }
00587         if (LocaleCompare("coalesce",option+1) == 0)
00588           break;
00589         if (LocaleCompare("colormap",option+1) == 0)
00590           {
00591             resource_info.colormap=PrivateColormap;
00592             if (*option == '+')
00593               break;
00594             i++;
00595             if (i == (long) argc)
00596               ThrowAnimateException(OptionError,"MissingArgument",option);
00597             resource_info.colormap=UndefinedColormap;
00598             if (LocaleCompare("private",argv[i]) == 0)
00599               resource_info.colormap=PrivateColormap;
00600             if (LocaleCompare("shared",argv[i]) == 0)
00601               resource_info.colormap=SharedColormap;
00602             if (resource_info.colormap == UndefinedColormap)
00603               ThrowAnimateException(OptionError,"UnrecognizedColormapType",
00604                 argv[i]);
00605             break;
00606           }
00607         if (LocaleCompare("colors",option+1) == 0)
00608           {
00609             quantize_info->number_colors=0;
00610             if (*option == '+')
00611               break;
00612             i++;
00613             if (i == (long) argc)
00614               ThrowAnimateException(OptionError,"MissingArgument",option);
00615             if (IsGeometry(argv[i]) == MagickFalse)
00616               ThrowAnimateInvalidArgumentException(option,argv[i]);
00617             quantize_info->number_colors=(unsigned long) atol(argv[i]);
00618             break;
00619           }
00620         if (LocaleCompare("colorspace",option+1) == 0)
00621           {
00622             long
00623               colorspace;
00624 
00625             if (*option == '+')
00626               break;
00627             i++;
00628             if (i == (long) argc)
00629               ThrowAnimateException(OptionError,"MissingArgument",option);
00630             colorspace=ParseMagickOption(MagickColorspaceOptions,
00631               MagickFalse,argv[i]);
00632             if (colorspace < 0)
00633               ThrowAnimateException(OptionError,"UnrecognizedColorspace",
00634                 argv[i]);
00635             break;
00636           }
00637         if (LocaleCompare("concurrent",option+1) == 0)
00638           break;
00639         if (LocaleCompare("crop",option+1) == 0)
00640           {
00641             if (*option == '+')
00642               break;
00643             i++;
00644             if (i == (long) argc)
00645               ThrowAnimateException(OptionError,"MissingArgument",option);
00646             if (IsGeometry(argv[i]) == MagickFalse)
00647               ThrowAnimateInvalidArgumentException(option,argv[i]);
00648             break;
00649           }
00650         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
00651       }
00652       case 'd':
00653       {
00654         if (LocaleCompare("debug",option+1) == 0)
00655           {
00656             long
00657               event;
00658 
00659             if (*option == '+')
00660               break;
00661             i++;
00662             if (i == (long) argc)
00663               ThrowAnimateException(OptionError,"MissingArgument",option);
00664             event=ParseMagickOption(MagickLogEventOptions,MagickFalse,argv[i]);
00665             if (event < 0)
00666               ThrowAnimateException(OptionError,"UnrecognizedEventType",
00667                 argv[i]);
00668             (void) SetLogEventMask(argv[i]);
00669             break;
00670           }
00671         if (LocaleCompare("decipher",option+1) == 0)
00672           {
00673             if (*option == '+')
00674               break;
00675             i++;
00676             if (i == (long) (argc-1))
00677               ThrowAnimateException(OptionError,"MissingArgument",option);
00678             break;
00679           }
00680         if (LocaleCompare("define",option+1) == 0)
00681           {
00682             i++;
00683             if (i == (long) argc)
00684               ThrowAnimateException(OptionError,"MissingArgument",option);
00685             if (*option == '+')
00686               {
00687                 const char
00688                   *define;
00689 
00690                 define=GetImageOption(image_info,argv[i]);
00691                 if (define == (const char *) NULL)
00692                   ThrowAnimateException(OptionError,"NoSuchOption",argv[i]);
00693                 break;
00694               }
00695             break;
00696           }
00697         if (LocaleCompare("delay",option+1) == 0)
00698           {
00699             if (*option == '+')
00700               break;
00701             i++;
00702             if (i == (long) argc)
00703               ThrowAnimateException(OptionError,"MissingArgument",option);
00704             if (IsGeometry(argv[i]) == MagickFalse)
00705               ThrowAnimateInvalidArgumentException(option,argv[i]);
00706             break;
00707           }
00708         if (LocaleCompare("density",option+1) == 0)
00709           {
00710             if (*option == '+')
00711               break;
00712             i++;
00713             if (i == (long) argc)
00714               ThrowAnimateException(OptionError,"MissingArgument",option);
00715             if (IsGeometry(argv[i]) == MagickFalse)
00716               ThrowAnimateInvalidArgumentException(option,argv[i]);
00717             break;
00718           }
00719         if (LocaleCompare("depth",option+1) == 0)
00720           {
00721             if (*option == '+')
00722               break;
00723             i++;
00724             if (i == (long) argc)
00725               ThrowAnimateException(OptionError,"MissingArgument",option);
00726             if (IsGeometry(argv[i]) == MagickFalse)
00727               ThrowAnimateInvalidArgumentException(option,argv[i]);
00728             break;
00729           }
00730         if (LocaleCompare("display",option+1) == 0)
00731           {
00732             if (*option == '+')
00733               break;
00734             i++;
00735             if (i == (long) argc)
00736               ThrowAnimateException(OptionError,"MissingArgument",option);
00737             break;
00738           }
00739         if (LocaleCompare("dispose",option+1) == 0)
00740           {
00741             long
00742               dispose;
00743 
00744             if (*option == '+')
00745               break;
00746             i++;
00747             if (i == (long) argc)
00748               ThrowAnimateException(OptionError,"MissingArgument",option);
00749             dispose=ParseMagickOption(MagickDisposeOptions,MagickFalse,argv[i]);
00750             if (dispose < 0)
00751               ThrowAnimateException(OptionError,"UnrecognizedDisposeMethod",
00752                 argv[i]);
00753             break;
00754           }
00755         if (LocaleCompare("dither",option+1) == 0)
00756           {
00757             long
00758               method;
00759 
00760             quantize_info->dither=MagickFalse;
00761             if (*option == '+')
00762               break;
00763             i++;
00764             if (i == (long) argc)
00765               ThrowAnimateException(OptionError,"MissingArgument",option);
00766             method=ParseMagickOption(MagickDitherOptions,MagickFalse,argv[i]);
00767             if (method < 0)
00768               ThrowAnimateException(OptionError,"UnrecognizedDitherMethod",
00769                 argv[i]);
00770             quantize_info->dither=MagickTrue;
00771             quantize_info->dither_method=(DitherMethod) method;
00772             break;
00773           }
00774         if (LocaleCompare("duration",option+1) == 0)
00775           {
00776             if (*option == '+')
00777               break;
00778             i++;
00779             if (i == (long) (argc-1))
00780               ThrowAnimateException(OptionError,"MissingArgument",option);
00781             if (IsGeometry(argv[i]) == MagickFalse)
00782               ThrowAnimateInvalidArgumentException(option,argv[i]);
00783             break;
00784           }
00785         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
00786       }
00787       case 'e':
00788       {
00789         if (LocaleCompare("extract",option+1) == 0)
00790           {
00791             if (*option == '+')
00792               break;
00793             i++;
00794             if (i == (long) argc)
00795               ThrowAnimateException(OptionError,"MissingArgument",option);
00796             if (IsGeometry(argv[i]) == MagickFalse)
00797               ThrowAnimateInvalidArgumentException(option,argv[i]);
00798             break;
00799           }
00800         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
00801       }
00802       case 'f':
00803       {
00804         if (LocaleCompare("filter",option+1) == 0)
00805           {
00806             long
00807               filter;
00808 
00809             if (*option == '+')
00810               break;
00811             i++;
00812             if (i == (long) (argc-1))
00813               ThrowAnimateException(OptionError,"MissingArgument",option);
00814             filter=ParseMagickOption(MagickFilterOptions,MagickFalse,argv[i]);
00815             if (filter < 0)
00816               ThrowAnimateException(OptionError,"UnrecognizedImageFilter",
00817                 argv[i]);
00818             break;
00819           }
00820         if (LocaleCompare("flatten",option+1) == 0)
00821           break;
00822         if (LocaleCompare("font",option+1) == 0)
00823           {
00824             if (*option == '+')
00825               break;
00826             i++;
00827             if (i == (long) argc)
00828               ThrowAnimateException(OptionError,"MissingArgument",option);
00829             resource_info.font=XGetResourceClass(resource_database,
00830               GetClientName(),"font",argv[i]);
00831             break;
00832           }
00833         if (LocaleCompare("foreground",option+1) == 0)
00834           {
00835             if (*option == '+')
00836               break;
00837             i++;
00838             if (i == (long) argc)
00839               ThrowAnimateException(OptionError,"MissingArgument",option);
00840             resource_info.foreground_color=argv[i];
00841             break;
00842           }
00843         if (LocaleCompare("format",option+1) == 0)
00844           {
00845             if (*option == '+')
00846               break;
00847             i++;
00848             if (i == (long) (argc-1))
00849               ThrowAnimateException(OptionError,"MissingArgument",option);
00850             break;
00851           }
00852         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
00853       }
00854       case 'g':
00855       {
00856         if (LocaleCompare("gamma",option+1) == 0)
00857           {
00858             i++;
00859             if (i == (long) argc)
00860               ThrowAnimateException(OptionError,"MissingArgument",option);
00861             if (IsGeometry(argv[i]) == MagickFalse)
00862               ThrowAnimateInvalidArgumentException(option,argv[i]);
00863             break;
00864           }
00865         if (LocaleCompare("geometry",option+1) == 0)
00866           {
00867             resource_info.image_geometry=(char *) NULL;
00868             if (*option == '+')
00869               break;
00870             i++;
00871             if (i == (long) argc)
00872               ThrowAnimateException(OptionError,"MissingArgument",option);
00873             if (IsGeometry(argv[i]) == MagickFalse)
00874               ThrowAnimateInvalidArgumentException(option,argv[i]);
00875             resource_info.image_geometry=ConstantString(argv[i]);
00876             break;
00877           }
00878         if (LocaleCompare("gravity",option+1) == 0)
00879           {
00880             long
00881               gravity;
00882 
00883             if (*option == '+')
00884               break;
00885             i++;
00886             if (i == (long) (argc-1))
00887               ThrowAnimateException(OptionError,"MissingArgument",option);
00888             gravity=ParseMagickOption(MagickGravityOptions,MagickFalse,
00889               argv[i]);
00890             if (gravity < 0)
00891               ThrowAnimateException(OptionError,"UnrecognizedGravityType",
00892                 argv[i]);
00893             break;
00894           }
00895         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
00896       }
00897       case 'h':
00898       {
00899         if ((LocaleCompare("help",option+1) == 0) ||
00900             (LocaleCompare("-help",option+1) == 0))
00901           break;
00902         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
00903       }
00904       case 'i':
00905       {
00906         if (LocaleCompare("iconGeometry",option+1) == 0)
00907           {
00908             resource_info.icon_geometry=(char *) NULL;
00909             if (*option == '+')
00910               break;
00911             i++;
00912             if (i == (long) argc)
00913               ThrowAnimateException(OptionError,"MissingArgument",option);
00914             if (IsGeometry(argv[i]) == MagickFalse)
00915               ThrowAnimateInvalidArgumentException(option,argv[i]);
00916             resource_info.icon_geometry=argv[i];
00917             break;
00918           }
00919         if (LocaleCompare("iconic",option+1) == 0)
00920           {
00921             resource_info.iconic=(*option == '-') ? MagickTrue : MagickFalse;
00922             break;
00923           }
00924         if (LocaleCompare("identify",option+1) == 0)
00925           break;
00926         if (LocaleCompare("immutable",option+1) == 0)
00927           {
00928             resource_info.immutable=(*option == '-') ? MagickTrue : MagickFalse;
00929             break;
00930           }
00931         if (LocaleCompare("interlace",option+1) == 0)
00932           {
00933             long
00934               interlace;
00935 
00936             if (*option == '+')
00937               break;
00938             i++;
00939             if (i == (long) argc)
00940               ThrowAnimateException(OptionError,"MissingArgument",option);
00941             interlace=ParseMagickOption(MagickInterlaceOptions,MagickFalse,
00942               argv[i]);
00943             if (interlace < 0)
00944               ThrowAnimateException(OptionError,"UnrecognizedInterlaceType",
00945                 argv[i]);
00946             break;
00947           }
00948         if (LocaleCompare("interpolate",option+1) == 0)
00949           {
00950             long
00951               interpolate;
00952 
00953             if (*option == '+')
00954               break;
00955             i++;
00956             if (i == (long) argc)
00957               ThrowAnimateException(OptionError,"MissingArgument",option);
00958             interpolate=ParseMagickOption(MagickInterpolateOptions,MagickFalse,
00959               argv[i]);
00960             if (interpolate < 0)
00961               ThrowAnimateException(OptionError,"UnrecognizedInterpolateMethod",
00962                 argv[i]);
00963             break;
00964           }
00965         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
00966       }
00967       case 'l':
00968       {
00969         if (LocaleCompare("label",option+1) == 0)
00970           {
00971             if (*option == '+')
00972               break;
00973             i++;
00974             if (i == (long) argc)
00975               ThrowAnimateException(OptionError,"MissingArgument",option);
00976             break;
00977           }
00978         if (LocaleCompare("limit",option+1) == 0)
00979           {
00980             char
00981               *p;
00982 
00983             double
00984               value;
00985 
00986             long
00987               resource;
00988 
00989             if (*option == '+')
00990               break;
00991             i++;
00992             if (i == (long) argc)
00993               ThrowAnimateException(OptionError,"MissingArgument",option);
00994             resource=ParseMagickOption(MagickResourceOptions,MagickFalse,
00995               argv[i]);
00996             if (resource < 0)
00997               ThrowAnimateException(OptionError,"UnrecognizedResourceType",
00998                 argv[i]);
00999             i++;
01000             if (i == (long) argc)
01001               ThrowAnimateException(OptionError,"MissingArgument",option);
01002             value=strtod(argv[i],&p);
01003             if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0))
01004               ThrowAnimateInvalidArgumentException(option,argv[i]);
01005             break;
01006           }
01007         if (LocaleCompare("list",option+1) == 0)
01008           {
01009             long
01010               list;
01011 
01012             if (*option == '+')
01013               break;
01014             i++;
01015             if (i == (long) argc)
01016               ThrowAnimateException(OptionError,"MissingArgument",option);
01017             list=ParseMagickOption(MagickListOptions,MagickFalse,argv[i]);
01018             if (list < 0)
01019               ThrowAnimateException(OptionError,"UnrecognizedListType",argv[i]);
01020             (void) MogrifyImageInfo(image_info,(int) (i-j+1),(const char **)
01021               argv+j,exception);
01022             DestroyAnimate();
01023             return(MagickTrue);
01024           }
01025         if (LocaleCompare("log",option+1) == 0)
01026           {
01027             if (*option == '+')
01028               break;
01029             i++;
01030             if ((i == (long) argc) ||
01031                 (strchr(argv[i],'%') == (char *) NULL))
01032               ThrowAnimateException(OptionError,"MissingArgument",option);
01033             break;
01034           }
01035         if (LocaleCompare("loop",option+1) == 0)
01036           {
01037             if (*option == '+')
01038               break;
01039             i++;
01040             if (i == (long) (argc-1))
01041               ThrowAnimateException(OptionError,"MissingArgument",option);
01042             if (IsGeometry(argv[i]) == MagickFalse)
01043               ThrowAnimateInvalidArgumentException(option,argv[i]);
01044             break;
01045           }
01046         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
01047       }
01048       case 'm':
01049       {
01050         if (LocaleCompare("map",option+1) == 0)
01051           {
01052             resource_info.map_type=(char *) NULL;
01053             if (*option == '+')
01054               break;
01055             (void) CopyMagickString(argv[i]+1,"san",MaxTextExtent);
01056             i++;
01057             if (i == (long) argc)
01058               ThrowAnimateException(OptionError,"MissingArgument",option);
01059             resource_info.map_type=argv[i];
01060             break;
01061           }
01062         if (LocaleCompare("matte",option+1) == 0)
01063           break;
01064         if (LocaleCompare("mattecolor",option+1) == 0)
01065           {
01066             if (*option == '+')
01067               break;
01068             i++;
01069             if (i == (long) argc)
01070               ThrowAnimateException(OptionError,"MissingArgument",option);
01071             resource_info.matte_color=argv[i];
01072             break;
01073           }
01074         if (LocaleCompare("monitor",option+1) == 0)
01075           break;
01076         if (LocaleCompare("monochrome",option+1) == 0)
01077           {
01078             if (*option == '+')
01079               break;
01080             quantize_info->number_colors=2;
01081             quantize_info->colorspace=GRAYColorspace;
01082             break;
01083           }
01084         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
01085       }
01086       case 'n':
01087       {
01088         if (LocaleCompare("name",option+1) == 0)
01089           {
01090             resource_info.name=(char *) NULL;
01091             if (*option == '+')
01092               break;
01093             i++;
01094             if (i == (long) argc)
01095               ThrowAnimateException(OptionError,"MissingArgument",option);
01096             resource_info.name=ConstantString(argv[i]);
01097             break;
01098           }
01099         if (LocaleCompare("noop",option+1) == 0)
01100           break;
01101         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
01102       }
01103       case 'p':
01104       {
01105         if (LocaleCompare("pause",option+1) == 0)
01106           {
01107             resource_info.pause=0;
01108             if (*option == '+')
01109               break;
01110             i++;
01111             if (i == (long) argc)
01112               ThrowAnimateException(OptionError,"MissingArgument",option);
01113             if (IsGeometry(argv[i]) == MagickFalse)
01114               ThrowAnimateInvalidArgumentException(option,argv[i]);
01115             resource_info.pause=(unsigned int) atoi(argv[i]);
01116             break;
01117           }
01118         if (LocaleCompare("page",option+1) == 0)
01119           {
01120             if (*option == '+')
01121               break;
01122             i++;
01123             if (i == (long) argc)
01124               ThrowAnimateException(OptionError,"MissingArgument",option);
01125             break;
01126           }
01127         if (LocaleCompare("profile",option+1) == 0)
01128           {
01129             i++;
01130             if (i == (long) argc)
01131               ThrowAnimateException(OptionError,"MissingArgument",option);
01132             break;
01133           }
01134         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
01135       }
01136       case 'q':
01137       {
01138         if (LocaleCompare("quantize",option+1) == 0)
01139           {
01140             long
01141               colorspace;
01142 
01143             if (*option == '+')
01144               break;
01145             i++;
01146             if (i == (long) (argc-1))
01147               ThrowAnimateException(OptionError,"MissingArgument",option);
01148             colorspace=ParseMagickOption(MagickColorspaceOptions,
01149               MagickFalse,argv[i]);
01150             if (colorspace < 0)
01151               ThrowAnimateException(OptionError,"UnrecognizedColorspace",
01152                 argv[i]);
01153             break;
01154           }
01155         if (LocaleCompare("quiet",option+1) == 0)
01156           break;
01157         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
01158       }
01159       case 'r':
01160       {
01161         if (LocaleCompare("regard-warnings",option+1) == 0)
01162           break;
01163         if (LocaleCompare("remote",option+1) == 0)
01164           {
01165             i++;
01166             if (i == (long) argc)
01167               ThrowAnimateException(OptionError,"MissingArgument",option);
01168             if (XRemoteCommand(display,resource_info.window_id,argv[i]) != 0)
01169               return(MagickFalse);
01170             i--;
01171             break;
01172           }
01173         if (LocaleCompare("repage",option+1) == 0)
01174           {
01175             if (*option == '+')
01176               break;
01177             i++;
01178             if (i == (long) argc)
01179               ThrowAnimateException(OptionError,"MissingArgument",option);
01180             if (IsGeometry(argv[i]) == MagickFalse)
01181               ThrowAnimateInvalidArgumentException(option,argv[i]);
01182             break;
01183           }
01184         if (LocaleCompare("resample",option+1) == 0)
01185           {
01186             if (*option == '+')
01187               break;
01188             i++;
01189             if (i == (long) (argc-1))
01190               ThrowAnimateException(OptionError,"MissingArgument",option);
01191             if (IsGeometry(argv[i]) == MagickFalse)
01192               ThrowAnimateInvalidArgumentException(option,argv[i]);
01193             break;
01194           }
01195         if (LocaleCompare("resize",option+1) == 0)
01196           {
01197             if (*option == '+')
01198               break;
01199             i++;
01200             if (i == (long) argc)
01201               ThrowAnimateException(OptionError,"MissingArgument",option);
01202             if (IsGeometry(argv[i]) == MagickFalse)
01203               ThrowAnimateInvalidArgumentException(option,argv[i]);
01204             break;
01205           }
01206         if (LocaleNCompare("respect-parentheses",option+1,17) == 0)
01207           {
01208             respect_parenthesis=(*option == '-') ? MagickTrue : MagickFalse;
01209             break;
01210           }
01211         if (LocaleCompare("rotate",option+1) == 0)
01212           {
01213             i++;
01214             if (i == (long) argc)
01215               ThrowAnimateException(OptionError,"MissingArgument",option);
01216             if (IsGeometry(argv[i]) == MagickFalse)
01217               ThrowAnimateInvalidArgumentException(option,argv[i]);
01218             break;
01219           }
01220         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
01221       }
01222       case 's':
01223       {
01224         if (LocaleCompare("sampling-factor",option+1) == 0)
01225           {
01226             if (*option == '+')
01227               break;
01228             i++;
01229             if (i == (long) argc)
01230               ThrowAnimateException(OptionError,"MissingArgument",option);
01231             if (IsGeometry(argv[i]) == MagickFalse)
01232               ThrowAnimateInvalidArgumentException(option,argv[i]);
01233             break;
01234           }
01235         if (LocaleCompare("seed",option+1) == 0)
01236           {
01237             if (*option == '+')
01238               break;
01239             i++;
01240             if (i == (long) (argc-1))
01241               ThrowAnimateException(OptionError,"MissingArgument",option);
01242             if (IsGeometry(argv[i]) == MagickFalse)
01243               ThrowAnimateInvalidArgumentException(option,argv[i]);
01244             break;
01245           }
01246         if (LocaleCompare("scenes",option+1) == 0)  /* deprecated */
01247           {
01248             if (*option == '+')
01249               break;
01250             i++;
01251             if (i == (long) argc)
01252               ThrowAnimateException(OptionError,"MissingArgument",option);
01253             if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse)
01254               ThrowAnimateInvalidArgumentException(option,argv[i]);
01255             break;
01256           }
01257         if (LocaleCompare("set",option+1) == 0)
01258           {
01259             i++;
01260             if (i == (long) argc)
01261               ThrowAnimateException(OptionError,"MissingArgument",option);
01262             if (*option == '+')
01263               break;
01264             i++;
01265             if (i == (long) argc)
01266               ThrowAnimateException(OptionError,"MissingArgument",option);
01267             break;
01268           }
01269         if (LocaleCompare("shared-memory",option+1) == 0)
01270           {
01271             resource_info.use_shared_memory=(*option == '-') ? MagickTrue :
01272               MagickFalse;
01273             break;
01274           }
01275         if (LocaleCompare("size",option+1) == 0)
01276           {
01277             if (*option == '+')
01278               break;
01279             i++;
01280             if (i == (long) argc)
01281               ThrowAnimateException(OptionError,"MissingArgument",option);
01282             if (IsGeometry(argv[i]) == MagickFalse)
01283               ThrowAnimateInvalidArgumentException(option,argv[i]);
01284             break;
01285           }
01286         if (LocaleCompare("strip",option+1) == 0)
01287           break;
01288         if (LocaleCompare("support",option+1) == 0)
01289           {
01290             i++;  /* deprecated */
01291             break;
01292           }
01293         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
01294       }
01295       case 't':
01296       {
01297         if (LocaleCompare("text-font",option+1) == 0)
01298           {
01299             resource_info.text_font=(char *) NULL;
01300             if (*option == '+')
01301               break;
01302             i++;
01303             if (i == (long) argc)
01304               ThrowAnimateException(OptionError,"MissingArgument",option);
01305             resource_info.text_font=XGetResourceClass(resource_database,
01306               GetClientName(),"font",argv[i]);
01307             break;
01308           }
01309         if (LocaleCompare("thumbnail",option+1) == 0)
01310           {
01311             if (*option == '+')
01312               break;
01313             i++;
01314             if (i == (long) argc)
01315               ThrowAnimateException(OptionError,"MissingArgument",option);
01316             if (IsGeometry(argv[i]) == MagickFalse)
01317               ThrowAnimateInvalidArgumentException(option,argv[i]);
01318             break;
01319           }
01320         if (LocaleCompare("title",option+1) == 0)
01321           {
01322             resource_info.title=(char *) NULL;
01323             if (*option == '+')
01324               break;
01325             i++;
01326             if (i == (long) argc)
01327               ThrowAnimateException(OptionError,"MissingArgument",option);
01328             resource_info.title=argv[i];
01329             break;
01330           }
01331         if (LocaleCompare("transparent-color",option+1) == 0)
01332           {
01333             if (*option == '+')
01334               break;
01335             i++;
01336             if (i == (long) (argc-1))
01337               ThrowAnimateException(OptionError,"MissingArgument",option);
01338             break;
01339           }
01340         if (LocaleCompare("treedepth",option+1) == 0)
01341           {
01342             quantize_info->tree_depth=0;
01343             if (*option == '+')
01344               break;
01345             i++;
01346             if (i == (long) argc)
01347               ThrowAnimateException(OptionError,"MissingArgument",option);
01348             if (IsGeometry(argv[i]) == MagickFalse)
01349               ThrowAnimateInvalidArgumentException(option,argv[i]);
01350             quantize_info->tree_depth=(unsigned long) atol(argv[i]);
01351             break;
01352           }
01353         if (LocaleCompare("trim",option+1) == 0)
01354           break;
01355         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
01356       }
01357       case 'v':
01358       {
01359         if (LocaleCompare("verbose",option+1) == 0)
01360           break;
01361         if ((LocaleCompare("version",option+1) == 0) ||
01362             (LocaleCompare("-version",option+1) == 0))
01363           {
01364             (void) fprintf(stdout,"Version: %s\n",
01365               GetMagickVersion((unsigned long *) NULL));
01366             (void) fprintf(stdout,"Copyright: %s\n",GetMagickCopyright());
01367             (void) fprintf(stdout,"Features: %s\n\n",GetMagickFeatures());
01368             break;
01369           }
01370         if (LocaleCompare("virtual-pixel",option+1) == 0)
01371           {
01372             long
01373               method;
01374 
01375             if (*option == '+')
01376               break;
01377             i++;
01378             if (i == (long) argc)
01379               ThrowAnimateException(OptionError,"MissingArgument",option);
01380             method=ParseMagickOption(MagickVirtualPixelOptions,MagickFalse,
01381               argv[i]);
01382             if (method < 0)
01383               ThrowAnimateException(OptionError,
01384                 "UnrecognizedVirtualPixelMethod",argv[i]);
01385             break;
01386           }
01387         if (LocaleCompare("visual",option+1) == 0)
01388           {
01389             resource_info.visual_type=(char *) NULL;
01390             if (*option == '+')
01391               break;
01392             i++;
01393             if (i == (long) argc)
01394               ThrowAnimateException(OptionError,"MissingArgument",option);
01395             resource_info.visual_type=argv[i];
01396             break;
01397           }
01398         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
01399       }
01400       case 'w':
01401       {
01402         if (LocaleCompare("window",option+1) == 0)
01403           {
01404             resource_info.window_id=(char *) NULL;
01405             if (*option == '+')
01406               break;
01407             i++;
01408             if (i == (long) argc)
01409               ThrowAnimateException(OptionError,"MissingArgument",option);
01410             resource_info.window_id=argv[i];
01411             break;
01412           }
01413         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
01414       }
01415       case '?':
01416         break;
01417       default:
01418         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
01419     }
01420     fire=ParseMagickOption(MagickImageListOptions,MagickFalse,option+1) < 0 ?
01421       MagickFalse : MagickTrue;
01422     if (fire != MagickFalse)
01423       FireImageStack(MagickFalse,MagickTrue,MagickTrue);
01424   }
01425   i--;
01426   if (k != 0)
01427     ThrowAnimateException(OptionError,"UnbalancedParenthesis",argv[i]);
01428   if (image == (Image *) NULL)
01429     ThrowAnimateException(OptionError,"MissingAnImageFilename",argv[argc-1])
01430   FinalizeImageSettings(image_info,image,MagickTrue);
01431   if (image == (Image *) NULL)
01432     ThrowAnimateException(OptionError,"MissingAnImageFilename",argv[argc-1])
01433   if (resource_info.window_id != (char *) NULL)
01434     {
01435       XAnimateBackgroundImage(display,&resource_info,image);
01436       status&=MagickTrue;
01437     }
01438   else
01439     {
01440       Image
01441         *animate_image;
01442 
01443       /*
01444         Animate image to X server.
01445       */
01446       animate_image=XAnimateImages(display,&resource_info,argv,argc,image);
01447       status&=animate_image != (Image *) NULL;
01448       while (animate_image != (Image *) NULL)
01449       {
01450         image=animate_image;
01451         animate_image=XAnimateImages(display,&resource_info,argv,argc,image);
01452         if (animate_image != image)
01453           image=DestroyImageList(image);
01454       }
01455     }
01456   DestroyAnimate();
01457   return(status != 0 ? MagickTrue : MagickFalse);
01458 #else
01459   (void) argc;
01460   (void) argv;
01461   (void) ThrowMagickException(exception,GetMagickModule(),MissingDelegateError,
01462     "DelegateLibrarySupportNotBuiltIn","`%s' (X11)",image_info->filename);
01463   return(AnimateUsage());
01464 #endif
01465 }

Generated on 19 Nov 2009 for MagickWand by  doxygen 1.6.1