PageRenderTime 30ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 1ms

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

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

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