~ubuntu-branches/ubuntu/quantal/imagemagick/quantal

« back to all changes in this revision

Viewing changes to wand/montage.c

  • Committer: Bazaar Package Importer
  • Author(s): Muharem Hrnjadovic
  • Date: 2009-06-04 13:01:13 UTC
  • mfrom: (1.1.5 upstream) (6.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20090604130113-my9114jxmafpwew3
Tags: 7:6.5.1.0-1.1ubuntu1
* Merge from debian unstable, remaining changes:
  - (Build-)depend on libltdl7-dev instead of libltdl3-dev (the armel buildds
    currently have both available).
  - Don't build-dep on librsvg, it brings in excessive dependencies

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
%                                 July 1992                                   %
18
18
%                                                                             %
19
19
%                                                                             %
20
 
%  Copyright 1999-2008 ImageMagick Studio LLC, a non-profit organization      %
 
20
%  Copyright 1999-2009 ImageMagick Studio LLC, a non-profit organization      %
21
21
%  dedicated to making software imaging solutions freely available.           %
22
22
%                                                                             %
23
23
%  You may not use this file except in compliance with the License.  You may  %
74
74
%
75
75
%    o metadata: any metadata is returned here.
76
76
%
77
 
%    o exception: Return any errors or warnings in this structure.
 
77
%    o exception: return any errors or warnings in this structure.
78
78
%
79
79
*/
80
80
 
81
 
static void MontageUsage(void)
 
81
static MagickBooleanType MontageUsage(void)
82
82
{
83
83
  const char
84
84
    **p;
95
95
    },
96
96
    *operators[]=
97
97
    {
 
98
      "-adaptive-sharpen geometry",
 
99
      "                     adaptively sharpen pixels; increase effect near edges",
98
100
      " annotate geometry text",
99
101
      "                     annotate the image with text",
100
102
      "-blur geometry      reduce image noise and reduce detail levels",
111
113
      "-rotate degrees      apply Paeth rotation to the image",
112
114
      "-strip               strip image of all profiles and comments",
113
115
      "-transform           affine transform image",
 
116
      "-transpose           flip image vertically and rotate 90 degrees",
114
117
      "-transparent color   make this color transparent within the image",
115
118
      "-type type           image type",
 
119
      "-unsharp geometry    sharpen the image",
116
120
      (char *) NULL
117
121
    },
118
122
    *settings[]=
167
171
      "-quiet               suppress all warning messages",
168
172
      "-red-primary point   chromaticity red primary point",
169
173
      "-regard-warnings     pay attention to warning messages",
170
 
      "-respect-parenthesis settings remain in effect until parenthesis boundary",
 
174
      "-respect-parentheses settings remain in effect until parenthesis boundary",
171
175
      "-sampling-factor geometry",
172
176
      "                     horizontal and vertical sampling factor",
173
177
      "-scenes range        image scene range",
179
183
      "-texture filename    name of texture to tile onto the image background",
180
184
      "-thumbnail geometry  create a thumbnail of the image",
181
185
      "-tile geometry       number of tiles per row and column",
 
186
      "-title string        decorate the montage image with a title",
182
187
      "-transparent-color color",
183
188
      "                     transparent color",
184
189
      "-treedepth value     color tree depth",
235
240
  (void) printf(
236
241
    "image type as the filename suffix (i.e. image.ps).  Specify 'file' as\n");
237
242
  (void) printf("'-' for standard input or output.\n");
238
 
  exit(0);
 
243
  return(MagickFalse);
239
244
}
240
245
 
241
246
WandExport MagickBooleanType MontageImageCommand(ImageInfo *image_info,
260
265
#define ThrowMontageInvalidArgumentException(option,argument) \
261
266
{ \
262
267
  (void) ThrowMagickException(exception,GetMagickModule(),OptionError, \
263
 
    "InvalidArgument","`%s': %s",argument,option); \
 
268
    "InvalidArgument","`%s': %s",option,argument); \
264
269
  DestroyMontage(); \
265
270
  return(MagickFalse); \
266
271
}
320
325
        }
321
326
    }
322
327
  if (argc < 3)
323
 
   MontageUsage();
 
328
    {
 
329
      (void) MontageUsage();
 
330
      return(MagickTrue);
 
331
    }
324
332
  format="%w,%h,%m";
325
333
  first_scene=0;
326
334
  j=1;
388
396
              /*
389
397
                Form filename for multi-part images.
390
398
              */
391
 
              (void) InterpretImageFilename(filename,MaxTextExtent,
392
 
                image_info->filename,(int) scene);
 
399
              (void) InterpretImageFilename(image_info,(Image *) NULL,
 
400
                image_info->filename,(int) scene,filename);
393
401
              if (LocaleCompare(filename,image_info->filename) == 0)
394
402
                (void) FormatMagickString(filename,MaxTextExtent,"%s.%lu",
395
403
                  image_info->filename,scene);
411
419
    {
412
420
      case 'a':
413
421
      {
 
422
        if (LocaleCompare("adaptive-sharpen",option+1) == 0)
 
423
          {
 
424
            i++;
 
425
            if (i == (long) (argc-1))
 
426
              ThrowMontageException(OptionError,"MissingArgument",option);
 
427
            if (IsGeometry(argv[i]) == MagickFalse)
 
428
              ThrowMontageInvalidArgumentException(option,argv[i]);
 
429
            break;
 
430
          }
414
431
        if (LocaleCompare("adjoin",option+1) == 0)
415
432
          break;
416
433
        if (LocaleCompare("affine",option+1) == 0)
587
604
              clone_images=image_stack[k-1].image;
588
605
            if (clone_images == (Image *) NULL)
589
606
              ThrowMontageException(ImageError,"ImageSequenceRequired",option);
 
607
            FireImageStack(MagickTrue,MagickTrue,MagickTrue);
590
608
            if (*option == '+')
591
609
              clone_images=CloneImages(clone_images,"-1",exception);
592
610
            else
600
618
              }
601
619
            if (clone_images == (Image *) NULL)
602
620
              ThrowMontageException(OptionError,"NoSuchImage",option);
603
 
            FireImageStack(MagickTrue,MagickTrue,MagickTrue);
604
621
            AppendImageStack(clone_images);
605
622
            break;
606
623
          }
961
978
      {
962
979
        if ((LocaleCompare("help",option+1) == 0) ||
963
980
            (LocaleCompare("-help",option+1) == 0))
964
 
          MontageUsage();
 
981
          return(MontageUsage());
965
982
        ThrowMontageException(OptionError,"UnrecognizedOption",option)
966
983
      }
967
984
      case 'i':
1020
1037
            char
1021
1038
              *p;
1022
1039
 
 
1040
            double
 
1041
              value;
 
1042
 
1023
1043
            long
1024
1044
              resource;
1025
1045
 
1036
1056
            i++;
1037
1057
            if (i == (long) argc)
1038
1058
              ThrowMontageException(OptionError,"MissingArgument",option);
1039
 
            (void) strtod(argv[i],&p);
 
1059
            value=strtod(argv[i],&p);
1040
1060
            if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0))
1041
1061
              ThrowMontageInvalidArgumentException(option,argv[i]);
1042
1062
            break;
1043
1063
          }
 
1064
        if (LocaleCompare("list",option+1) == 0)
 
1065
          {
 
1066
            long
 
1067
              list;
 
1068
 
 
1069
            if (*option == '+')
 
1070
              break;
 
1071
            i++;
 
1072
            if (i == (long) argc)
 
1073
              ThrowMontageException(OptionError,"MissingArgument",option);
 
1074
            list=ParseMagickOption(MagickListOptions,MagickFalse,argv[i]);
 
1075
            if (list < 0)
 
1076
              ThrowMontageException(OptionError,"UnrecognizedListType",argv[i]);
 
1077
            (void) MogrifyImageInfo(image_info,(int) (i-j+1),(const char **)
 
1078
              argv+j,exception);
 
1079
            DestroyMontage();
 
1080
            return(MagickTrue);
 
1081
          }
1044
1082
        if (LocaleCompare("log",option+1) == 0)
1045
1083
          {
1046
1084
            if (*option == '+')
1257
1295
              ThrowMontageInvalidArgumentException(option,argv[i]);
1258
1296
            break;
1259
1297
          }
1260
 
        if (LocaleCompare("respect-parenthesis",option+1) == 0)
 
1298
        if (LocaleNCompare("respect-parentheses",option+1,17) == 0)
1261
1299
          {
1262
1300
            respect_parenthesis=(*option == '-') ? MagickTrue : MagickFalse;
1263
1301
            break;
1327
1365
          }
1328
1366
        if (LocaleCompare("shadow",option+1) == 0)
1329
1367
          {
 
1368
            (void) CopyMagickString(argv[i]+1,"sans",MaxTextExtent);
1330
1369
            montage_info->shadow=(*option == '-') ? MagickTrue : MagickFalse;
1331
 
            (void) CopyMagickString(argv[i]+1,"sans0",MaxTextExtent);
1332
1370
            break;
1333
1371
          }
1334
1372
        if (LocaleCompare("sharpen",option+1) == 0)
1445
1483
          }
1446
1484
        if (LocaleCompare("transform",option+1) == 0)
1447
1485
          break;
 
1486
        if (LocaleCompare("transpose",option+1) == 0)
 
1487
          break;
1448
1488
        if (LocaleCompare("title",option+1) == 0)
1449
1489
          {
1450
1490
            (void) CloneString(&montage_info->title,(char *) NULL);
1528
1568
                argv[i]);
1529
1569
            break;
1530
1570
          }
 
1571
        if (LocaleCompare("unsharp",option+1) == 0)
 
1572
          {
 
1573
            if (*option == '+')
 
1574
              break;
 
1575
            i++;
 
1576
            if (i == (long) (argc-1))
 
1577
              ThrowMontageException(OptionError,"MissingArgument",option);
 
1578
            if (IsGeometry(argv[i]) == MagickFalse)
 
1579
              ThrowMontageInvalidArgumentException(option,argv[i]);
 
1580
            break;
 
1581
          }
1531
1582
        ThrowMontageException(OptionError,"UnrecognizedOption",option)
1532
1583
      }
1533
1584
      case 'v':
1608
1659
      (void) CopyMagickString(image_info->filename,argv[argc-1],MaxTextExtent);
1609
1660
      (void) CopyMagickString(montage_image->magick_filename,argv[argc-1],
1610
1661
        MaxTextExtent);
 
1662
      if (*montage_image->magick == '\0')
 
1663
        (void) CopyMagickString(montage_image->magick,image->magick,
 
1664
          MaxTextExtent);
1611
1665
      status&=WriteImages(image_info,montage_image,argv[argc-1],exception);
1612
1666
      if (metadata != (char **) NULL)
1613
1667
        {