PageRenderTime 87ms CodeModel.GetById 47ms RepoModel.GetById 0ms app.codeStats 0ms

/MagickWand/animate.c

https://gitlab.com/ImageMagick/ImageMagick
C | 1435 lines | 1290 code | 37 blank | 108 comment | 583 complexity | 9ef57e4e89f93bb372d7c4130c000b47 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception

Large files files are truncated, but you can click here to view the full file

  1. /*
  2. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  3. % %
  4. % %
  5. % %
  6. % AAA N N IIIII M M AAA TTTTT EEEEE %
  7. % A A NN N I MM MM A A T E %
  8. % AAAAA N N N I M M M AAAAA T EEE %
  9. % A A N NN I M M A A T E %
  10. % A A N N IIIII M M A A T EEEEE %
  11. % %
  12. % %
  13. % Methods to Interactively Animate an Image Sequence %
  14. % %
  15. % Software Design %
  16. % Cristy %
  17. % July 1992 %
  18. % %
  19. % %
  20. % Copyright 1999-2019 ImageMagick Studio LLC, a non-profit organization %
  21. % dedicated to making software imaging solutions freely available. %
  22. % %
  23. % You may not use this file except in compliance with the License. You may %
  24. % obtain a copy of the License at %
  25. % %
  26. % https://imagemagick.org/script/license.php %
  27. % %
  28. % Unless required by applicable law or agreed to in writing, software %
  29. % distributed under the License is distributed on an "AS IS" BASIS, %
  30. % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
  31. % See the License for the specific language governing permissions and %
  32. % limitations under the License. %
  33. % %
  34. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  35. %
  36. % Use the animate program to animate an image sequence on any X server.
  37. %
  38. */
  39. /*
  40. Include declarations.
  41. */
  42. #include "MagickWand/studio.h"
  43. #include "MagickWand/MagickWand.h"
  44. #include "MagickWand/mogrify-private.h"
  45. #include "MagickCore/animate-private.h"
  46. #include "MagickCore/string-private.h"
  47. /*
  48. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  49. % %
  50. % %
  51. % %
  52. + A n i m a t e I m a g e C o m m a n d %
  53. % %
  54. % %
  55. % %
  56. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  57. %
  58. % AnimateImageCommand() displays a sequence of images on any workstation
  59. % display running an X server. Animate first determines the hardware
  60. % capabilities of the workstation. If the number of unique colors in an image
  61. % is less than or equal to the number the workstation can support, the image
  62. % is displayed in an X window. Otherwise the number of colors in the image is
  63. % first reduced to match the color resolution of the workstation before it is
  64. % displayed.
  65. %
  66. % This means that a continuous-tone 24 bits/pixel image can display on a 8
  67. % bit pseudo-color device or monochrome device. In most instances the reduced
  68. % color image closely resembles the original. Alternatively, a monochrome or
  69. % pseudo-color image sequence can display on a continuous-tone 24 bits/pixels
  70. % device.
  71. %
  72. % The format of the AnimateImageCommand method is:
  73. %
  74. % MagickBooleanType AnimateImageCommand(ImageInfo *image_info,int argc,
  75. % char **argv,char **metadata,ExceptionInfo *exception)
  76. %
  77. % A description of each parameter follows:
  78. %
  79. % o image_info: the image info.
  80. %
  81. % o argc: the number of elements in the argument vector.
  82. %
  83. % o argv: A text array containing the command line arguments.
  84. %
  85. % o metadata: any metadata is returned here.
  86. %
  87. % o exception: return any errors or warnings in this structure.
  88. %
  89. */
  90. static MagickBooleanType AnimateUsage(void)
  91. {
  92. static const char
  93. buttons[] =
  94. " Press any button to map or unmap the Command widget",
  95. miscellaneous[] =
  96. " -debug events display copious debugging information\n"
  97. " -help print program options\n"
  98. " -list type print a list of supported option arguments\n"
  99. " -log format format of debugging information\n"
  100. " -version print version information",
  101. operators[] =
  102. " -channel mask set the image channel mask\n"
  103. " -colors value preferred number of colors in the image\n"
  104. " -crop geometry preferred size and location of the cropped image\n"
  105. " -extract geometry extract area from image\n"
  106. " -monochrome transform image to black and white\n"
  107. " -resample geometry change the resolution of an image\n"
  108. " -resize geometry resize the image\n"
  109. " -rotate degrees apply Paeth rotation to the image\n"
  110. " -strip strip image of all profiles and comments\n"
  111. " -thumbnail geometry create a thumbnail of the image\n"
  112. " -trim trim image edges",
  113. settings[] =
  114. " -alpha option on, activate, off, deactivate, set, opaque, copy\n"
  115. " transparent, extract, background, or shape\n"
  116. " -authenticate password\n"
  117. " decipher image with this password\n"
  118. " -backdrop display image centered on a backdrop\n"
  119. " -colormap type Shared or Private\n"
  120. " -colorspace type alternate image colorspace\n"
  121. " -decipher filename convert cipher pixels to plain pixels\n"
  122. " -define format:option\n"
  123. " define one or more image format options\n"
  124. " -delay value display the next image after pausing\n"
  125. " -density geometry horizontal and vertical density of the image\n"
  126. " -depth value image depth\n"
  127. " -display server display image to this X server\n"
  128. " -dispose method layer disposal method\n"
  129. " -dither method apply error diffusion to image\n"
  130. " -filter type use this filter when resizing an image\n"
  131. " -format \"string\" output formatted image characteristics\n"
  132. " -gamma value level of gamma correction\n"
  133. " -geometry geometry preferred size and location of the Image window\n"
  134. " -gravity type horizontal and vertical backdrop placement\n"
  135. " -identify identify the format and characteristics of the image\n"
  136. " -immutable displayed image cannot be modified\n"
  137. " -interlace type type of image interlacing scheme\n"
  138. " -interpolate method pixel color interpolation method\n"
  139. " -limit type value pixel cache resource limit\n"
  140. " -loop iterations loop images then exit\n"
  141. " -matte store matte channel if the image has one\n"
  142. " -map type display image using this Standard Colormap\n"
  143. " -monitor monitor progress\n"
  144. " -pause seconds to pause before reanimating\n"
  145. " -page geometry size and location of an image canvas (setting)\n"
  146. " -quantize colorspace reduce colors in this colorspace\n"
  147. " -quiet suppress all warning messages\n"
  148. " -regard-warnings pay attention to warning messages\n"
  149. " -remote command execute a command in an remote display process\n"
  150. " -repage geometry size and location of an image canvas (operator)\n"
  151. " -respect-parentheses settings remain in effect until parenthesis boundary\n"
  152. " -sampling-factor geometry\n"
  153. " horizontal and vertical sampling factor\n"
  154. " -scenes range image scene range\n"
  155. " -seed value seed a new sequence of pseudo-random numbers\n"
  156. " -set attribute value set an image attribute\n"
  157. " -size geometry width and height of image\n"
  158. " -support factor resize support: > 1.0 is blurry, < 1.0 is sharp\n"
  159. " -transparent-color color\n"
  160. " transparent color\n"
  161. " -treedepth value color tree depth\n"
  162. " -verbose print detailed information about the image\n"
  163. " -visual type display image using this visual type\n"
  164. " -virtual-pixel method\n"
  165. " virtual pixel access method\n"
  166. " -window id display image to background of this window",
  167. sequence_operators[] =
  168. " -coalesce merge a sequence of images\n"
  169. " -flatten flatten a sequence of images";
  170. ListMagickVersion(stdout);
  171. (void) printf("Usage: %s [options ...] file [ [options ...] file ...]\n",
  172. GetClientName());
  173. (void) printf("\nImage Settings:\n");
  174. (void) puts(settings);
  175. (void) printf("\nImage Operators:\n");
  176. (void) puts(operators);
  177. (void) printf("\nImage Sequence Operators:\n");
  178. (void) puts(sequence_operators);
  179. (void) printf("\nMiscellaneous Options:\n");
  180. (void) puts(miscellaneous);
  181. (void) printf(
  182. "\nIn addition to those listed above, you can specify these standard X\n");
  183. (void) printf(
  184. "resources as command line options: -background, -bordercolor,\n");
  185. (void) printf(
  186. "-mattecolor, -borderwidth, -font, -foreground, -iconGeometry,\n");
  187. (void) printf("-iconic, -name, -shared-memory, or -title.\n");
  188. (void) printf(
  189. "\nBy default, the image format of 'file' is determined by its magic\n");
  190. (void) printf(
  191. "number. To specify a particular image format, precede the filename\n");
  192. (void) printf(
  193. "with an image format name and a colon (i.e. ps:image) or specify the\n");
  194. (void) printf(
  195. "image type as the filename suffix (i.e. image.ps). Specify 'file' as\n");
  196. (void) printf("'-' for standard input or output.\n");
  197. (void) printf("\nButtons: \n");
  198. (void) puts(buttons);
  199. return(MagickFalse);
  200. }
  201. WandExport MagickBooleanType AnimateImageCommand(ImageInfo *image_info,
  202. int argc,char **argv,char **wand_unused(metadata),ExceptionInfo *exception)
  203. {
  204. #if defined(MAGICKCORE_X11_DELEGATE)
  205. #define DestroyAnimate() \
  206. { \
  207. XDestroyResourceInfo(&resource_info); \
  208. if (display != (Display *) NULL) \
  209. { \
  210. XCloseDisplay(display); \
  211. display=(Display *) NULL; \
  212. } \
  213. XDestroyResourceInfo(&resource_info); \
  214. DestroyImageStack(); \
  215. for (i=0; i < (ssize_t) argc; i++) \
  216. argv[i]=DestroyString(argv[i]); \
  217. argv=(char **) RelinquishMagickMemory(argv); \
  218. }
  219. #define ThrowAnimateException(asperity,tag,option) \
  220. { \
  221. (void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"`%s'", \
  222. option); \
  223. DestroyAnimate(); \
  224. return(MagickFalse); \
  225. }
  226. #define ThrowAnimateInvalidArgumentException(option,argument) \
  227. { \
  228. (void) ThrowMagickException(exception,GetMagickModule(),OptionError, \
  229. "InvalidArgument","'%s': %s",option,argument); \
  230. DestroyAnimate(); \
  231. return(MagickFalse); \
  232. }
  233. char
  234. *resource_value,
  235. *server_name;
  236. const char
  237. *option;
  238. Display
  239. *display;
  240. Image
  241. *image;
  242. ImageStack
  243. image_stack[MaxImageStackDepth+1];
  244. MagickBooleanType
  245. fire,
  246. pend,
  247. respect_parenthesis;
  248. MagickStatusType
  249. status;
  250. QuantizeInfo
  251. *quantize_info;
  252. register ssize_t
  253. i;
  254. ssize_t
  255. j,
  256. k;
  257. XResourceInfo
  258. resource_info;
  259. XrmDatabase
  260. resource_database;
  261. /*
  262. Set defaults.
  263. */
  264. assert(image_info != (ImageInfo *) NULL);
  265. assert(image_info->signature == MagickCoreSignature);
  266. if (image_info->debug != MagickFalse)
  267. (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
  268. assert(exception != (ExceptionInfo *) NULL);
  269. if (argc == 2)
  270. {
  271. option=argv[1];
  272. if ((LocaleCompare("version",option+1) == 0) ||
  273. (LocaleCompare("-version",option+1) == 0))
  274. {
  275. ListMagickVersion(stdout);
  276. return(MagickTrue);
  277. }
  278. }
  279. status=MagickTrue;
  280. SetNotifyHandlers;
  281. display=(Display *) NULL;
  282. j=1;
  283. k=0;
  284. NewImageStack();
  285. option=(char *) NULL;
  286. pend=MagickFalse;
  287. respect_parenthesis=MagickFalse;
  288. resource_database=(XrmDatabase) NULL;
  289. (void) memset(&resource_info,0,sizeof(XResourceInfo));
  290. server_name=(char *) NULL;
  291. status=MagickTrue;
  292. /*
  293. Check for server name specified on the command line.
  294. */
  295. ReadCommandlLine(argc,&argv);
  296. status=ExpandFilenames(&argc,&argv);
  297. if (status == MagickFalse)
  298. ThrowAnimateException(ResourceLimitError,"MemoryAllocationFailed",
  299. image_info->filename);
  300. for (i=1; i < (ssize_t) argc; i++)
  301. {
  302. /*
  303. Check command line for server name.
  304. */
  305. option=argv[i];
  306. if (IsCommandOption(option) == MagickFalse)
  307. continue;
  308. if (LocaleCompare("display",option+1) == 0)
  309. {
  310. /*
  311. User specified server name.
  312. */
  313. i++;
  314. if (i == (ssize_t) argc)
  315. ThrowAnimateException(OptionError,"MissingArgument",option);
  316. server_name=argv[i];
  317. }
  318. if ((LocaleCompare("help",option+1) == 0) ||
  319. (LocaleCompare("-help",option+1) == 0))
  320. return(AnimateUsage());
  321. }
  322. /*
  323. Get user defaults from X resource database.
  324. */
  325. display=XOpenDisplay(server_name);
  326. if (display == (Display *) NULL)
  327. ThrowAnimateException(XServerError,"UnableToOpenXServer",
  328. XDisplayName(server_name));
  329. (void) XSetErrorHandler(XError);
  330. resource_database=XGetResourceDatabase(display,GetClientName());
  331. XGetResourceInfo(image_info,resource_database,GetClientName(),
  332. &resource_info);
  333. quantize_info=resource_info.quantize_info;
  334. image_info->density=XGetResourceInstance(resource_database,GetClientName(),
  335. "density",(char *) NULL);
  336. if (image_info->density == (char *) NULL)
  337. image_info->density=XGetScreenDensity(display);
  338. resource_value=XGetResourceInstance(resource_database,GetClientName(),
  339. "interlace","none");
  340. image_info->interlace=(InterlaceType)
  341. ParseCommandOption(MagickInterlaceOptions,MagickFalse,resource_value);
  342. resource_value=XGetResourceInstance(resource_database,GetClientName(),
  343. "verbose","False");
  344. image_info->verbose=IsStringTrue(resource_value);
  345. resource_value=XGetResourceInstance(resource_database,GetClientName(),
  346. "dither","True");
  347. quantize_info->dither_method=IsStringTrue(resource_value) != MagickFalse ?
  348. RiemersmaDitherMethod : NoDitherMethod;
  349. /*
  350. Parse command line.
  351. */
  352. for (i=1; i <= (ssize_t) argc; i++)
  353. {
  354. if (i < (ssize_t) argc)
  355. option=argv[i];
  356. else
  357. if (image != (Image *) NULL)
  358. break;
  359. else
  360. if (isatty(STDIN_FILENO) != MagickFalse)
  361. option="logo:";
  362. else
  363. option="-";
  364. if (LocaleCompare(option,"(") == 0)
  365. {
  366. FireImageStack(MagickFalse,MagickTrue,pend);
  367. if (k == MaxImageStackDepth)
  368. ThrowAnimateException(OptionError,"ParenthesisNestedTooDeeply",
  369. option);
  370. PushImageStack();
  371. continue;
  372. }
  373. if (LocaleCompare(option,")") == 0)
  374. {
  375. FireImageStack(MagickFalse,MagickTrue,MagickTrue);
  376. if (k == 0)
  377. ThrowAnimateException(OptionError,"UnableToParseExpression",option);
  378. PopImageStack();
  379. continue;
  380. }
  381. if (IsCommandOption(option) == MagickFalse)
  382. {
  383. const char
  384. *filename;
  385. Image
  386. *images;
  387. /*
  388. Read input image.
  389. */
  390. FireImageStack(MagickFalse,MagickFalse,pend);
  391. filename=option;
  392. if ((LocaleCompare(filename,"--") == 0) && (i < (ssize_t) (argc-1)))
  393. {
  394. option=argv[++i];
  395. filename=option;
  396. }
  397. if (image_info->ping != MagickFalse)
  398. images=PingImages(image_info,filename,exception);
  399. else
  400. images=ReadImages(image_info,filename,exception);
  401. status&=(images != (Image *) NULL) &&
  402. (exception->severity < ErrorException);
  403. if (images == (Image *) NULL)
  404. continue;
  405. AppendImageStack(images);
  406. continue;
  407. }
  408. pend=image != (Image *) NULL ? MagickTrue : MagickFalse;
  409. switch (*(option+1))
  410. {
  411. case 'a':
  412. {
  413. if (LocaleCompare("alpha",option+1) == 0)
  414. {
  415. ssize_t
  416. type;
  417. if (*option == '+')
  418. break;
  419. i++;
  420. if (i == (ssize_t) argc)
  421. ThrowAnimateException(OptionError,"MissingArgument",option);
  422. type=ParseCommandOption(MagickAlphaChannelOptions,MagickFalse,
  423. argv[i]);
  424. if (type < 0)
  425. ThrowAnimateException(OptionError,
  426. "UnrecognizedAlphaChannelOption",argv[i]);
  427. break;
  428. }
  429. if (LocaleCompare("authenticate",option+1) == 0)
  430. {
  431. if (*option == '+')
  432. break;
  433. i++;
  434. if (i == (ssize_t) argc)
  435. ThrowAnimateException(OptionError,"MissingArgument",option);
  436. break;
  437. }
  438. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  439. }
  440. case 'b':
  441. {
  442. if (LocaleCompare("backdrop",option+1) == 0)
  443. {
  444. resource_info.backdrop=(*option == '-') ? MagickTrue : MagickFalse;
  445. break;
  446. }
  447. if (LocaleCompare("background",option+1) == 0)
  448. {
  449. if (*option == '+')
  450. break;
  451. i++;
  452. if (i == (ssize_t) argc)
  453. ThrowAnimateException(OptionError,"MissingArgument",option);
  454. resource_info.background_color=argv[i];
  455. break;
  456. }
  457. if (LocaleCompare("bordercolor",option+1) == 0)
  458. {
  459. if (*option == '+')
  460. break;
  461. i++;
  462. if (i == (ssize_t) argc)
  463. ThrowAnimateException(OptionError,"MissingArgument",option);
  464. resource_info.border_color=argv[i];
  465. break;
  466. }
  467. if (LocaleCompare("borderwidth",option+1) == 0)
  468. {
  469. resource_info.border_width=0;
  470. if (*option == '+')
  471. break;
  472. i++;
  473. if ((i == (ssize_t) argc) || (IsGeometry(argv[i]) == MagickFalse))
  474. ThrowAnimateException(OptionError,"MissingArgument",option);
  475. resource_info.border_width=(unsigned int)
  476. StringToUnsignedLong(argv[i]);
  477. break;
  478. }
  479. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  480. }
  481. case 'c':
  482. {
  483. if (LocaleCompare("cache",option+1) == 0)
  484. {
  485. if (*option == '+')
  486. break;
  487. i++;
  488. if (i == (ssize_t) argc)
  489. ThrowAnimateException(OptionError,"MissingArgument",option);
  490. if (IsGeometry(argv[i]) == MagickFalse)
  491. ThrowAnimateInvalidArgumentException(option,argv[i]);
  492. break;
  493. }
  494. if (LocaleCompare("channel",option+1) == 0)
  495. {
  496. ssize_t
  497. channel;
  498. if (*option == '+')
  499. break;
  500. i++;
  501. if (i == (ssize_t) argc)
  502. ThrowAnimateException(OptionError,"MissingArgument",option);
  503. channel=ParseChannelOption(argv[i]);
  504. if (channel < 0)
  505. ThrowAnimateException(OptionError,"UnrecognizedChannelType",
  506. argv[i]);
  507. break;
  508. }
  509. if (LocaleCompare("clone",option+1) == 0)
  510. {
  511. Image
  512. *clone_images;
  513. clone_images=image;
  514. if (k != 0)
  515. clone_images=image_stack[k-1].image;
  516. if (clone_images == (Image *) NULL)
  517. ThrowAnimateException(ImageError,"UnableToCloneImage",option);
  518. FireImageStack(MagickFalse,MagickTrue,MagickTrue);
  519. if (*option == '+')
  520. clone_images=CloneImages(clone_images,"-1",exception);
  521. else
  522. {
  523. i++;
  524. if (i == (ssize_t) argc)
  525. ThrowAnimateException(OptionError,"MissingArgument",option);
  526. if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse)
  527. ThrowAnimateInvalidArgumentException(option,argv[i]);
  528. clone_images=CloneImages(clone_images,argv[i],exception);
  529. }
  530. if (clone_images == (Image *) NULL)
  531. ThrowAnimateException(OptionError,"NoSuchImage",option);
  532. AppendImageStack(clone_images);
  533. break;
  534. }
  535. if (LocaleCompare("coalesce",option+1) == 0)
  536. break;
  537. if (LocaleCompare("colormap",option+1) == 0)
  538. {
  539. resource_info.colormap=PrivateColormap;
  540. if (*option == '+')
  541. break;
  542. i++;
  543. if (i == (ssize_t) argc)
  544. ThrowAnimateException(OptionError,"MissingArgument",option);
  545. resource_info.colormap=UndefinedColormap;
  546. if (LocaleCompare("private",argv[i]) == 0)
  547. resource_info.colormap=PrivateColormap;
  548. if (LocaleCompare("shared",argv[i]) == 0)
  549. resource_info.colormap=SharedColormap;
  550. if (resource_info.colormap == UndefinedColormap)
  551. ThrowAnimateException(OptionError,"UnrecognizedColormapType",
  552. argv[i]);
  553. break;
  554. }
  555. if (LocaleCompare("colors",option+1) == 0)
  556. {
  557. quantize_info->number_colors=0;
  558. if (*option == '+')
  559. break;
  560. i++;
  561. if (i == (ssize_t) argc)
  562. ThrowAnimateException(OptionError,"MissingArgument",option);
  563. if (IsGeometry(argv[i]) == MagickFalse)
  564. ThrowAnimateInvalidArgumentException(option,argv[i]);
  565. quantize_info->number_colors=StringToUnsignedLong(argv[i]);
  566. break;
  567. }
  568. if (LocaleCompare("colorspace",option+1) == 0)
  569. {
  570. ssize_t
  571. colorspace;
  572. if (*option == '+')
  573. break;
  574. i++;
  575. if (i == (ssize_t) argc)
  576. ThrowAnimateException(OptionError,"MissingArgument",option);
  577. colorspace=ParseCommandOption(MagickColorspaceOptions,
  578. MagickFalse,argv[i]);
  579. if (colorspace < 0)
  580. ThrowAnimateException(OptionError,"UnrecognizedColorspace",
  581. argv[i]);
  582. break;
  583. }
  584. if (LocaleCompare("concurrent",option+1) == 0)
  585. break;
  586. if (LocaleCompare("crop",option+1) == 0)
  587. {
  588. if (*option == '+')
  589. break;
  590. i++;
  591. if (i == (ssize_t) argc)
  592. ThrowAnimateException(OptionError,"MissingArgument",option);
  593. if (IsGeometry(argv[i]) == MagickFalse)
  594. ThrowAnimateInvalidArgumentException(option,argv[i]);
  595. break;
  596. }
  597. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  598. }
  599. case 'd':
  600. {
  601. if (LocaleCompare("debug",option+1) == 0)
  602. {
  603. ssize_t
  604. event;
  605. if (*option == '+')
  606. break;
  607. i++;
  608. if (i == (ssize_t) argc)
  609. ThrowAnimateException(OptionError,"MissingArgument",option);
  610. event=ParseCommandOption(MagickLogEventOptions,MagickFalse,argv[i]);
  611. if (event < 0)
  612. ThrowAnimateException(OptionError,"UnrecognizedEventType",
  613. argv[i]);
  614. (void) SetLogEventMask(argv[i]);
  615. break;
  616. }
  617. if (LocaleCompare("decipher",option+1) == 0)
  618. {
  619. if (*option == '+')
  620. break;
  621. i++;
  622. if (i == (ssize_t) argc)
  623. ThrowAnimateException(OptionError,"MissingArgument",option);
  624. break;
  625. }
  626. if (LocaleCompare("define",option+1) == 0)
  627. {
  628. i++;
  629. if (i == (ssize_t) argc)
  630. ThrowAnimateException(OptionError,"MissingArgument",option);
  631. if (*option == '+')
  632. {
  633. const char
  634. *define;
  635. define=GetImageOption(image_info,argv[i]);
  636. if (define == (const char *) NULL)
  637. ThrowAnimateException(OptionError,"NoSuchOption",argv[i]);
  638. break;
  639. }
  640. break;
  641. }
  642. if (LocaleCompare("delay",option+1) == 0)
  643. {
  644. if (*option == '+')
  645. break;
  646. i++;
  647. if (i == (ssize_t) argc)
  648. ThrowAnimateException(OptionError,"MissingArgument",option);
  649. if (IsGeometry(argv[i]) == MagickFalse)
  650. ThrowAnimateInvalidArgumentException(option,argv[i]);
  651. break;
  652. }
  653. if (LocaleCompare("density",option+1) == 0)
  654. {
  655. if (*option == '+')
  656. break;
  657. i++;
  658. if (i == (ssize_t) argc)
  659. ThrowAnimateException(OptionError,"MissingArgument",option);
  660. if (IsGeometry(argv[i]) == MagickFalse)
  661. ThrowAnimateInvalidArgumentException(option,argv[i]);
  662. break;
  663. }
  664. if (LocaleCompare("depth",option+1) == 0)
  665. {
  666. if (*option == '+')
  667. break;
  668. i++;
  669. if (i == (ssize_t) argc)
  670. ThrowAnimateException(OptionError,"MissingArgument",option);
  671. if (IsGeometry(argv[i]) == MagickFalse)
  672. ThrowAnimateInvalidArgumentException(option,argv[i]);
  673. break;
  674. }
  675. if (LocaleCompare("display",option+1) == 0)
  676. {
  677. if (*option == '+')
  678. break;
  679. i++;
  680. if (i == (ssize_t) argc)
  681. ThrowAnimateException(OptionError,"MissingArgument",option);
  682. break;
  683. }
  684. if (LocaleCompare("dispose",option+1) == 0)
  685. {
  686. ssize_t
  687. dispose;
  688. if (*option == '+')
  689. break;
  690. i++;
  691. if (i == (ssize_t) argc)
  692. ThrowAnimateException(OptionError,"MissingArgument",option);
  693. dispose=ParseCommandOption(MagickDisposeOptions,MagickFalse,argv[i]);
  694. if (dispose < 0)
  695. ThrowAnimateException(OptionError,"UnrecognizedDisposeMethod",
  696. argv[i]);
  697. break;
  698. }
  699. if (LocaleCompare("dither",option+1) == 0)
  700. {
  701. ssize_t
  702. method;
  703. quantize_info->dither_method=NoDitherMethod;
  704. if (*option == '+')
  705. break;
  706. i++;
  707. if (i == (ssize_t) argc)
  708. ThrowAnimateException(OptionError,"MissingArgument",option);
  709. method=ParseCommandOption(MagickDitherOptions,MagickFalse,argv[i]);
  710. if (method < 0)
  711. ThrowAnimateException(OptionError,"UnrecognizedDitherMethod",
  712. argv[i]);
  713. quantize_info->dither_method=(DitherMethod) method;
  714. break;
  715. }
  716. if (LocaleCompare("duration",option+1) == 0)
  717. {
  718. if (*option == '+')
  719. break;
  720. i++;
  721. if (i == (ssize_t) argc)
  722. ThrowAnimateException(OptionError,"MissingArgument",option);
  723. if (IsGeometry(argv[i]) == MagickFalse)
  724. ThrowAnimateInvalidArgumentException(option,argv[i]);
  725. break;
  726. }
  727. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  728. }
  729. case 'e':
  730. {
  731. if (LocaleCompare("extract",option+1) == 0)
  732. {
  733. if (*option == '+')
  734. break;
  735. i++;
  736. if (i == (ssize_t) argc)
  737. ThrowAnimateException(OptionError,"MissingArgument",option);
  738. if (IsGeometry(argv[i]) == MagickFalse)
  739. ThrowAnimateInvalidArgumentException(option,argv[i]);
  740. break;
  741. }
  742. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  743. }
  744. case 'f':
  745. {
  746. if (LocaleCompare("filter",option+1) == 0)
  747. {
  748. ssize_t
  749. filter;
  750. if (*option == '+')
  751. break;
  752. i++;
  753. if (i == (ssize_t) argc)
  754. ThrowAnimateException(OptionError,"MissingArgument",option);
  755. filter=ParseCommandOption(MagickFilterOptions,MagickFalse,argv[i]);
  756. if (filter < 0)
  757. ThrowAnimateException(OptionError,"UnrecognizedImageFilter",
  758. argv[i]);
  759. break;
  760. }
  761. if (LocaleCompare("flatten",option+1) == 0)
  762. break;
  763. if (LocaleCompare("font",option+1) == 0)
  764. {
  765. if (*option == '+')
  766. break;
  767. i++;
  768. if (i == (ssize_t) argc)
  769. ThrowAnimateException(OptionError,"MissingArgument",option);
  770. resource_info.font=XGetResourceClass(resource_database,
  771. GetClientName(),"font",argv[i]);
  772. break;
  773. }
  774. if (LocaleCompare("foreground",option+1) == 0)
  775. {
  776. if (*option == '+')
  777. break;
  778. i++;
  779. if (i == (ssize_t) argc)
  780. ThrowAnimateException(OptionError,"MissingArgument",option);
  781. resource_info.foreground_color=argv[i];
  782. break;
  783. }
  784. if (LocaleCompare("format",option+1) == 0)
  785. {
  786. if (*option == '+')
  787. break;
  788. i++;
  789. if (i == (ssize_t) argc)
  790. ThrowAnimateException(OptionError,"MissingArgument",option);
  791. break;
  792. }
  793. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  794. }
  795. case 'g':
  796. {
  797. if (LocaleCompare("gamma",option+1) == 0)
  798. {
  799. i++;
  800. if (i == (ssize_t) argc)
  801. ThrowAnimateException(OptionError,"MissingArgument",option);
  802. if (IsGeometry(argv[i]) == MagickFalse)
  803. ThrowAnimateInvalidArgumentException(option,argv[i]);
  804. break;
  805. }
  806. if (LocaleCompare("geometry",option+1) == 0)
  807. {
  808. resource_info.image_geometry=(char *) NULL;
  809. if (*option == '+')
  810. break;
  811. i++;
  812. if (i == (ssize_t) argc)
  813. ThrowAnimateException(OptionError,"MissingArgument",option);
  814. if (IsGeometry(argv[i]) == MagickFalse)
  815. ThrowAnimateInvalidArgumentException(option,argv[i]);
  816. resource_info.image_geometry=ConstantString(argv[i]);
  817. break;
  818. }
  819. if (LocaleCompare("gravity",option+1) == 0)
  820. {
  821. ssize_t
  822. gravity;
  823. if (*option == '+')
  824. break;
  825. i++;
  826. if (i == (ssize_t) argc)
  827. ThrowAnimateException(OptionError,"MissingArgument",option);
  828. gravity=ParseCommandOption(MagickGravityOptions,MagickFalse,
  829. argv[i]);
  830. if (gravity < 0)
  831. ThrowAnimateException(OptionError,"UnrecognizedGravityType",
  832. argv[i]);
  833. break;
  834. }
  835. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  836. }
  837. case 'h':
  838. {
  839. if ((LocaleCompare("help",option+1) == 0) ||
  840. (LocaleCompare("-help",option+1) == 0))
  841. break;
  842. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  843. }
  844. case 'i':
  845. {
  846. if (LocaleCompare("iconGeometry",option+1) == 0)
  847. {
  848. resource_info.icon_geometry=(char *) NULL;
  849. if (*option == '+')
  850. break;
  851. i++;
  852. if (i == (ssize_t) argc)
  853. ThrowAnimateException(OptionError,"MissingArgument",option);
  854. if (IsGeometry(argv[i]) == MagickFalse)
  855. ThrowAnimateInvalidArgumentException(option,argv[i]);
  856. resource_info.icon_geometry=argv[i];
  857. break;
  858. }
  859. if (LocaleCompare("iconic",option+1) == 0)
  860. {
  861. resource_info.iconic=(*option == '-') ? MagickTrue : MagickFalse;
  862. break;
  863. }
  864. if (LocaleCompare("identify",option+1) == 0)
  865. break;
  866. if (LocaleCompare("immutable",option+1) == 0)
  867. {
  868. resource_info.immutable=(*option == '-') ? MagickTrue : MagickFalse;
  869. break;
  870. }
  871. if (LocaleCompare("interlace",option+1) == 0)
  872. {
  873. ssize_t
  874. interlace;
  875. if (*option == '+')
  876. break;
  877. i++;
  878. if (i == (ssize_t) argc)
  879. ThrowAnimateException(OptionError,"MissingArgument",option);
  880. interlace=ParseCommandOption(MagickInterlaceOptions,MagickFalse,
  881. argv[i]);
  882. if (interlace < 0)
  883. ThrowAnimateException(OptionError,"UnrecognizedInterlaceType",
  884. argv[i]);
  885. break;
  886. }
  887. if (LocaleCompare("interpolate",option+1) == 0)
  888. {
  889. ssize_t
  890. interpolate;
  891. if (*option == '+')
  892. break;
  893. i++;
  894. if (i == (ssize_t) argc)
  895. ThrowAnimateException(OptionError,"MissingArgument",option);
  896. interpolate=ParseCommandOption(MagickInterpolateOptions,MagickFalse,
  897. argv[i]);
  898. if (interpolate < 0)
  899. ThrowAnimateException(OptionError,"UnrecognizedInterpolateMethod",
  900. argv[i]);
  901. break;
  902. }
  903. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  904. }
  905. case 'l':
  906. {
  907. if (LocaleCompare("label",option+1) == 0)
  908. {
  909. if (*option == '+')
  910. break;
  911. i++;
  912. if (i == (ssize_t) argc)
  913. ThrowAnimateException(OptionError,"MissingArgument",option);
  914. break;
  915. }
  916. if (LocaleCompare("limit",option+1) == 0)
  917. {
  918. char
  919. *p;
  920. double
  921. value;
  922. ssize_t
  923. resource;
  924. if (*option == '+')
  925. break;
  926. i++;
  927. if (i == (ssize_t) argc)
  928. ThrowAnimateException(OptionError,"MissingArgument",option);
  929. resource=ParseCommandOption(MagickResourceOptions,MagickFalse,
  930. argv[i]);
  931. if (resource < 0)
  932. ThrowAnimateException(OptionError,"UnrecognizedResourceType",
  933. argv[i]);
  934. i++;
  935. if (i == (ssize_t) argc)
  936. ThrowAnimateException(OptionError,"MissingArgument",option);
  937. value=StringToDouble(argv[i],&p);
  938. (void) value;
  939. if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0))
  940. ThrowAnimateInvalidArgumentException(option,argv[i]);
  941. break;
  942. }
  943. if (LocaleCompare("list",option+1) == 0)
  944. {
  945. ssize_t
  946. list;
  947. if (*option == '+')
  948. break;
  949. i++;
  950. if (i == (ssize_t) argc)
  951. ThrowAnimateException(OptionError,"MissingArgument",option);
  952. list=ParseCommandOption(MagickListOptions,MagickFalse,argv[i]);
  953. if (list < 0)
  954. ThrowAnimateException(OptionError,"UnrecognizedListType",argv[i]);
  955. status=MogrifyImageInfo(image_info,(int) (i-j+1),(const char **)
  956. argv+j,exception);
  957. DestroyAnimate();
  958. return(status == 0 ? MagickFalse : MagickTrue);
  959. }
  960. if (LocaleCompare("log",option+1) == 0)
  961. {
  962. if (*option == '+')
  963. break;
  964. i++;
  965. if ((i == (ssize_t) argc) ||
  966. (strchr(argv[i],'%') == (char *) NULL))
  967. ThrowAnimateException(OptionError,"MissingArgument",option);
  968. break;
  969. }
  970. if (LocaleCompare("loop",option+1) == 0)
  971. {
  972. if (*option == '+')
  973. break;
  974. i++;
  975. if (i == (ssize_t) argc)
  976. ThrowAnimateException(OptionError,"MissingArgument",option);
  977. if (IsGeometry(argv[i]) == MagickFalse)
  978. ThrowAnimateInvalidArgumentException(option,argv[i]);
  979. break;
  980. }
  981. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  982. }
  983. case 'm':
  984. {
  985. if (LocaleCompare("map",option+1) == 0)
  986. {
  987. resource_info.map_type=(char *) NULL;
  988. if (*option == '+')
  989. break;
  990. (void) CopyMagickString(argv[i]+1,"san",MagickPathExtent);
  991. i++;
  992. if (i == (ssize_t) argc)
  993. ThrowAnimateException(OptionError,"MissingArgument",option);
  994. resource_info.map_type=argv[i];
  995. break;
  996. }
  997. if (LocaleCompare("matte",option+1) == 0)
  998. break;
  999. if (LocaleCompare("mattecolor",option+1) == 0)
  1000. {
  1001. if (*option == '+')
  1002. break;
  1003. i++;
  1004. if (i == (ssize_t) argc)
  1005. ThrowAnimateException(OptionError,"MissingArgument",option);
  1006. resource_info.matte_color=argv[i];
  1007. break;
  1008. }
  1009. if (LocaleCompare("monitor",option+1) == 0)
  1010. break;
  1011. if (LocaleCompare("monochrome",option+1) == 0)
  1012. {
  1013. if (*option == '+')
  1014. break;
  1015. quantize_info->number_colors=2;
  1016. quantize_info->colorspace=GRAYColorspace;
  1017. break;
  1018. }
  1019. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  1020. }
  1021. case 'n':
  1022. {
  1023. if (LocaleCompare("name",option+1) == 0)
  1024. {
  1025. resource_info.name=(char *) NULL;
  1026. if (*option == '+')
  1027. break;
  1028. i++;
  1029. if (i == (ssize_t) argc)
  1030. ThrowAnimateException(OptionError,"MissingArgument",option);
  1031. resource_info.name=ConstantString(argv[i]);
  1032. break;
  1033. }
  1034. if (LocaleCompare("noop",option+1) == 0)
  1035. break;
  1036. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  1037. }
  1038. case 'p':
  1039. {
  1040. if (LocaleCompare("pause",option+1) == 0)
  1041. {
  1042. resource_info.pause=0;
  1043. if (*option == '+')
  1044. break;
  1045. i++;
  1046. if (i == (ssize_t) argc)
  1047. ThrowAnimateException(OptionError,"MissingArgument",option);
  1048. if (IsGeometry(argv[i]) == MagickFalse)
  1049. ThrowAnimateInvalidArgumentException(option,argv[i]);
  1050. resource_info.pause=(unsigned int) StringToUnsignedLong(argv[i]);
  1051. break;
  1052. }
  1053. if (LocaleCompare("page",option+1) == 0)
  1054. {
  1055. if (*option == '+')
  1056. break;
  1057. i++;
  1058. if (i == (ssize_t) argc)
  1059. ThrowAnimateException(OptionError,"MissingArgument",option);
  1060. break;
  1061. }
  1062. if (LocaleCompare("profile",option+1) == 0)
  1063. {
  1064. i++;
  1065. if (i == (ssize_t) argc)
  1066. ThrowAnimateException(OptionError,"MissingArgument",option);
  1067. break;
  1068. }
  1069. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  1070. }
  1071. case 'q':
  1072. {
  1073. if (LocaleCompare("quantize",option+1) == 0)
  1074. {
  1075. ssize_t
  1076. colorspace;
  1077. if (*option == '+')
  1078. break;
  1079. i++;
  1080. if (i == (ssize_t) argc)
  1081. ThrowAnimateException(OptionError,"MissingArgument",option);
  1082. colorspace=ParseCommandOption(MagickColorspaceOptions,
  1083. MagickFalse,argv[i]);
  1084. if (colorspace < 0)
  1085. ThrowAnimateException(OptionError,"UnrecognizedColorspace",
  1086. argv[i]);
  1087. break;
  1088. }
  1089. if (LocaleCompare("quiet",option+1) == 0)
  1090. break;
  1091. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  1092. }
  1093. case 'r':
  1094. {
  1095. if (LocaleCompare("regard-warnings",option+1) == 0)
  1096. break;
  1097. if (LocaleCompare("remote",option+1) == 0)
  1098. {
  1099. i++;
  1100. if (i == (ssize_t) argc)
  1101. ThrowAnimateException(OptionError,"MissingArgument",option);
  1102. if (XRemoteCommand(display,resource_info.window_id,argv[i]) != 0)
  1103. return(MagickFalse);
  1104. i--;
  1105. break;
  1106. }
  1107. if (LocaleCompare("repage",option+1) == 0)
  1108. {
  1109. if (*option == '+')
  1110. break;
  1111. i++;
  1112. if (i == (ssize_t) argc)
  1113. ThrowAnimateException(OptionError,"MissingArgument",option);
  1114. if (IsGeometry(argv[i]) == MagickFalse)
  1115. ThrowAnimateInvalidArgumentException(option,argv[i]);
  1116. break;
  1117. }
  1118. if (LocaleCompare("resample",option+1) == 0)
  1119. {
  1120. if (*option == '+')
  1121. break;
  1122. i++;
  1123. if (i == (ssize_t) argc)
  1124. ThrowAnimateException(OptionError,"MissingArgument",option);
  1125. if (IsGeometry(argv[i]) == MagickFalse)
  1126. ThrowAnimateInvalidArgumentException(option,argv[i]);
  1127. break;
  1128. }
  1129. if (LocaleCompare("resize",option+1) == 0)
  1130. {
  1131. if (*option == '+')
  1132. break;
  1133. i++;
  1134. if (i == (ssize_t) argc)
  1135. ThrowAnimateException(OptionError,"MissingArgument",option);
  1136. if (IsGeometry(argv[i]) == MagickFalse)
  1137. ThrowAnimateInvalidArgumentException(option,argv[i]);
  1138. break;
  1139. }
  1140. if (LocaleNCompare("respect-parentheses",option+1,17) == 0)
  1141. {
  1142. respect_parenthesis=(*option == '-') ? MagickTrue : MagickFalse;
  1143. break;
  1144. }
  1145. if (LocaleCompare("rotate",option+1) == 0)
  1146. {
  1147. i++;
  1148. if (i == (ssize_t) argc)
  1149. ThrowAnimateException(OptionError,"MissingArgument",option);
  1150. if (IsGeometry(argv[i]) == MagickFalse)
  1151. ThrowAnimateInvalidArgumentException(option,argv[i]);
  1152. break;
  1153. }
  1154. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  1155. }
  1156. case 's':
  1157. {
  1158. if (LocaleCompare("sampling-factor",option+1) == 0)
  1159. {
  1160. if (*option == '+')
  1161. break;
  1162. i++;
  1163. if (i == (ssize_t) argc)
  1164. ThrowAnimateException(OptionError,"MissingArgument",option);
  1165. if (IsGeometry(argv[i]) == MagickFalse)
  1166. ThrowAnimateInvalidArgumentException(option,argv[i]);
  1167. break;
  1168. }
  1169. if (LocaleCompare("seed",option+1) == 0)
  1170. {
  1171. if (*option == '+')
  1172. break;
  1173. i++;
  1174. if (i == (ssize_t) argc)
  1175. ThrowAnimateException(OptionError,"MissingArgument",option);
  1176. if (IsGeometry(argv[i]) == MagickFalse)
  1177. ThrowAnimateInvalidArgumentException(option,argv[i]);
  1178. break;
  1179. }
  1180. if (LocaleCompare("scenes",option+1) == 0) /* deprecated */
  1181. {
  1182. if (*option == '+')
  1183. break;
  1184. i++;
  1185. if (i == (ssize_t) argc)
  1186. ThrowAnimateException(OptionError,"MissingArgument",option);
  1187. if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse)
  1188. ThrowAnimateInvalidArgumentException(option,argv[i]);
  1189. break;
  1190. }
  1191. if (LocaleCompare("set",option+1) == 0)
  1192. {
  1193. i++;
  1194. if (i == (ssize_t) argc)
  1195. ThrowAnimateException(OptionError,"MissingArgument",option);
  1196. if (*option == '+')
  1197. break;
  1198. i++;
  1199. if (i == (ssize_t) argc)
  1200. ThrowAnimateException(OptionError,"MissingArgument",option);
  1201. break;
  1202. }
  1203. if (LocaleCompare("shared-memory",option+1) == 0)
  1204. {
  1205. resource_info.use_shared_memory=(*option == '-') ? MagickTrue :
  1206. MagickFalse;
  1207. break;
  1208. }
  1209. if (LocaleCompare("size",option+1) == 0)
  1210. {
  1211. if (*option == '+')
  1212. break;
  1213. i++;
  1214. if (i == (ssize_t) argc)
  1215. ThrowAnimateException(OptionError,"MissingArgument",option);
  1216. if (IsGeometry(argv[i]) == MagickFalse)
  1217. ThrowAnimateInvalidArgumentException(option,argv[i]);
  1218. break;
  1219. }
  1220. if (LocaleCompare("strip",option+1) == 0)
  1221. break;
  1222. if (LocaleCompare("support",option+1) == 0)
  1223. {
  1224. i++; /* deprecated */
  1225. break;
  1226. }
  1227. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  1228. }
  1229. case 't':
  1230. {
  1231. if (LocaleCompare("text-font",option+1) == 0)
  1232. {
  1233. resource_info.text_font=(char *) NULL;
  1234. if (*option == '+')
  1235. break;
  1236. i++;
  1237. if (i == (ssize_t) argc)
  1238. ThrowAnimateException(OptionError,"MissingArgument",option);
  1239. resource_info.text_font=XGetResourceClass(resource_database,
  1240. GetClientName(),"font",argv[i]);
  1241. break;
  1242. }
  1243. if (LocaleCompare("thumbnail",option+1) == 0)
  1244. {
  1245. if (*option == '+')
  1246. break;
  1247. i++;
  1248. if (i == (ssize_t) argc)
  1249. ThrowAnimateException(OptionError,"MissingArgument",option);
  1250. if (IsGeometry(argv[i]) == MagickFalse)
  1251. ThrowAnimateInvalidArgumentException(option,argv[i]);
  1252. break;
  1253. }
  1254. if (LocaleCompare("title",option+1) == 0)
  1255. {
  1256. resource_info.title=(char *) NULL;
  1257. if (*option == '+')
  1258. break;
  1259. i++;
  1260. if (i == (ssize_t) argc)
  1261. ThrowAnimateException(OptionError,"MissingArgument",option);
  1262. resource_info.title=argv[i];
  1263. break;
  1264. }
  1265. if (LocaleCompare("transparent-color",option+1) == 0)
  1266. {
  1267. if (*option == '+')
  1268. break;
  1269. i++;
  1270. if (i == (ssize_t) argc)
  1271. ThrowAnimateException(OptionError,"MissingArgument",option);
  1272. break;
  1273. }
  1274. if (LocaleCompare("treedepth",option+1) == 0)
  1275. {
  1276. quantize_info->tree_depth=0;
  1277. if (*option == '+')
  1278. break;
  1279. i++;
  1280. if (i == (ssize_t) argc)
  1281. ThrowAnimateException(OptionError,"MissingArgument",option);
  1282. if (IsGeometry(argv[i]) == MagickFalse)
  1283. ThrowAnimateInvalidArgumentException(option,argv[i]);
  1284. quantize_info->tree_depth=StringToUnsignedLong(argv[i]);
  1285. break;
  1286. }
  1287. if (LocaleCompare("trim",option+1) == 0)
  1288. break;
  1289. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  1290. }
  1291. case 'v':
  1292. {
  1293. if (LocaleCompare("verbose",option+1) == 0)
  1294. break;
  1295. if ((LocaleCompare("version",option+1) == 0) ||
  1296. (LocaleCompare("-version",option+1) == 0))
  1297. {
  1298. ListMagickVersion(stdout);
  1299. break;
  1300. }
  1301. if (LocaleCompare("virtual-pixel",option+1) == 0)
  1302. {
  1303. ssize_t
  1304. method;
  1305. if (*option == '+')
  1306. break;
  1307. i++;
  1308. if (i == (ssize_t) argc)
  1309. ThrowAnimateException(OptionError,"MissingArgument",option);
  1310. method=ParseCommandOption(MagickVirtualPixelOptions,MagickFalse,
  1311. argv[i]);
  1312. if (method < 0)
  1313. ThrowAnimateException(OptionError,
  1314. "UnrecognizedVirtualPixelMethod",argv[i]);
  1315. break;
  1316. }
  1317. if (LocaleCompare("visual",option+1) == 0)
  1318. {
  1319. resource_info.visual_type=(char *) NULL;
  1320. if (*option == '+')
  1321. break;
  1322. i++;
  1323. if (i == (ssize_t) argc)
  1324. ThrowAnimateException(OptionError,"MissingArgument",option);
  1325. resource_info.visual_type=argv[i];
  1326. break;
  1327. }
  1328. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  1329. }
  1330. case 'w':
  1331. {
  1332. if (LocaleCompare("window",option+1) == 0)
  1333. {
  1334. resource_info.window_id=(char *) NULL;
  1335. if (*option == '+')
  1336. break;
  1337. i++;
  1338. if (i == (ssize_t) argc)
  1339. ThrowAnimateException(OptionError,"MissingArgument",option);
  1340. resource_info.window_id=argv[i];
  1341. break;
  1342. }
  1343. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  1344. }
  1345. case '?':
  1346. break;
  1347. default:
  1348. ThrowAnimateException(OptionError,"UnrecognizedOption",option);

Large files files are truncated, but you can click here to view the full file