]> granicus.if.org Git - imagemagick/blobdiff - MagickWand/operation.c
(no commit message)
[imagemagick] / MagickWand / operation.c
index 22be52a99b5a7456925d74e609d55d9bcee34dbd..253fe10c95dfe014b5cf6873ca627b8b25855f11 100644 (file)
@@ -949,13 +949,24 @@ interpret Percent Escapes in Arguments, At least not yet */
     }
     case 'i':
     {
+      if (LocaleCompare("intensity",option+1) == 0)
+        {
+          arg1 = ArgOption("undefined");
+          parse = ParseCommandOption(MagickPixelIntensityOptions,MagickFalse,
+            arg1);
+          if (parse < 0)
+            CLIWandExceptArgBreak(OptionError,"UnrecognizedIntensityType",
+              option,arg1);
+          (void) SetImageOption(_image_info,option+1,arg1);
+          break;
+        }
       if (LocaleCompare("intent",option+1) == 0)
         {
           /* Only used by coders: MIFF, MPC, BMP, PNG
              and for image profile call to AcquireTransformThreadSet()
              SyncImageSettings() used to set per-image attribute.
           */
-          arg1 = ArgOption("indefined");
+          arg1 = ArgOption("undefined");
           parse = ParseCommandOption(MagickIntentOptions,MagickFalse,arg1);
           if (parse < 0)
             CLIWandExceptArgBreak(OptionError,"UnrecognizedIntentType",
@@ -1310,8 +1321,8 @@ interpret Percent Escapes in Arguments, At least not yet */
           if (IfMagickFalse(IsGeometry(arg1)))
             CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
           SetRandomSecretKey(
-               IfSetOption ? (const unsigned long) StringToUnsignedLong(arg1)
-                           : (const unsigned long) time((time_t *) NULL) );
+               IfSetOption ? (unsigned long) StringToUnsignedLong(arg1)
+                           : (unsigned long) time((time_t *) NULL) );
           break;
         }
       if (LocaleCompare("size",option+1) == 0)
@@ -2041,7 +2052,7 @@ static MagickBooleanType CLISimpleOperatorImage(MagickCLI *cli_wand,
              That seems to be a little strange!
           */
           (void) TransformImageColorspace(_image,
-                    IfNormalOp ? _image_info->colorspace : RGBColorspace,
+                    IfNormalOp ? _image_info->colorspace : sRGBColorspace,
                     _exception);
           break;
         }
@@ -2212,10 +2223,7 @@ static MagickBooleanType CLISimpleOperatorImage(MagickCLI *cli_wand,
           flags=ParseGeometry(arg1,&geometry_info);
           if ((flags & (RhoValue|SigmaValue)) == 0)
             CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
-          if ((flags & SigmaValue) == 0)
-            geometry_info.sigma=1.0;
-          new_image=EdgeImage(_image,geometry_info.rho,geometry_info.sigma,
-               _exception);
+          new_image=EdgeImage(_image,geometry_info.rho,_exception);
           break;
         }
       if (LocaleCompare("emboss",option+1) == 0)
@@ -2439,6 +2447,19 @@ static MagickBooleanType CLISimpleOperatorImage(MagickCLI *cli_wand,
               _image->filter,_exception);
           break;
         }
+      if (LocaleCompare("distort",option+1) == 0)
+        {
+          parse = ParseCommandOption(MagickPixelIntensityOptions,
+            MagickFalse,arg1);
+          if ( parse < 0 )
+             CLIWandExceptArgBreak(OptionError,"UnrecognizedIntensityMethod",
+               option,arg1);
+          _image->intensity = (PixelIntensityMethod) parse;
+          (void) TransformImageColorspace(_image,
+                    IfNormalOp ? _image_info->colorspace : GRAYColorspace,
+                    _exception);
+          break;
+        }
       CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
     }
     case 'i':
@@ -3486,18 +3507,18 @@ WandPrivate MagickBooleanType CLISimpleOperatorImages(MagickCLI *cli_wand,
 WandPrivate MagickBooleanType CLIListOperatorImages(MagickCLI *cli_wand,
   const char *option,const char *arg1n,const char *arg2n)
 {
-  MagickBooleanType
-    status;
-
-  ssize_t
-    parse;
+  const char    /* For percent escape interpretImageProperties() */
+    *arg1,
+    *arg2;
 
   Image
     *new_images;
 
-  const char    /* For percent escape interpretImageProperties() */
-    *arg1,
-    *arg2;
+  MagickStatusType
+    status;
+
+  ssize_t
+    parse;
 
 #define _image_info     (cli_wand->wand.image_info)
 #define _images         (cli_wand->wand.images)
@@ -3666,8 +3687,28 @@ WandPrivate MagickBooleanType CLIListOperatorImages(MagickCLI *cli_wand,
                 status&=CompositeImage(source_image,mask_image,
                   CopyGreenCompositeOp,MagickTrue,0,0,_exception);
               else
-                status&=CompositeImage(source_image,mask_image,
-                  IntensityCompositeOp,MagickTrue,0,0,_exception);
+                {
+                  Image
+                    *image;
+
+                  RectangleInfo
+                    source_geometry;
+
+                  source_geometry.width=mask_image->columns;
+                  source_geometry.height=mask_image->rows;
+                  source_geometry.x=(-geometry.x);
+                  source_geometry.y=(-geometry.y);
+                  geometry.x=0;
+                  geometry.y=0;
+                  image=ExtentImage(source_image,&source_geometry,_exception);
+                  if (image != (Image *) NULL)
+                    {
+                      source_image=DestroyImage(source_image);
+                      source_image=image;
+                    }
+                  status&=CompositeImage(source_image,mask_image,
+                    IntensityCompositeOp,MagickTrue,0,0,_exception);
+                }
               mask_image=DestroyImage(mask_image);
             }
           status&=CompositeImage(new_images,source_image,compose,clip_to_self,
@@ -4156,7 +4197,7 @@ WandPrivate MagickBooleanType CLIListOperatorImages(MagickCLI *cli_wand,
             metric=(MetricType) ParseCommandOption(MagickMetricOptions,
               MagickFalse,value);
 
-          new_images=SimilarityImage(base_image,compare_image,metric,
+          new_images=SimilarityImage(base_image,compare_image,metric,0.0,
                &offset,&similarity,_exception);
 
           if ( new_images != (Image *)NULL ) {
@@ -4192,8 +4233,8 @@ WandPrivate MagickBooleanType CLIListOperatorImages(MagickCLI *cli_wand,
           index,
           swap_index;
 
-        index=-1;
-        swap_index=-2;
+        index=(-1);
+        swap_index=(-2);
         if (IfNormalOp) {
           GeometryInfo
             geometry_info;
@@ -4203,7 +4244,7 @@ WandPrivate MagickBooleanType CLIListOperatorImages(MagickCLI *cli_wand,
 
           swap_index=(-1);
           flags=ParseGeometry(arg1,&geometry_info);
-          if ((flags & RhoValue) != 0)
+          if ((flags & RhoValue) == 0)
             CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
           index=(ssize_t) geometry_info.rho;
           if ((flags & SigmaValue) != 0)