PageRenderTime 54ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/scripts/ImageMagick-6.6.2-6/wand/animate.c

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

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