]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Wed, 31 Mar 2010 16:14:11 +0000 (16:14 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Wed, 31 Mar 2010 16:14:11 +0000 (16:14 +0000)
magick/fx.c
utilities/convert.1
utilities/convert.1.in
utilities/mogrify.1
utilities/mogrify.1.in
wand/convert.c
wand/magick-image.c
wand/mogrify.c

index d467484a0229039d77277a4b4e718cc28182b6c3..f1368f9d2f897bd39b41c39ca5cfe240f2c2a3c8 100644 (file)
@@ -3681,20 +3681,16 @@ MagickExport Image *RecolorImage(const Image *image,const unsigned long order,
     *image_view,
     *recolor_view;
 
-  const double
-    *recolor_matrix[6];
-
   double
-    RecolorMatrix[] =
+    recolor_matrix[6][6] =
     {
-      1.0, 0.0, 0.0, 0.0, 0.0, 0.0,
-      0.0, 1.0, 0.0, 0.0, 0.0, 0.0,
-      0.0, 0.0, 1.0, 0.0, 0.0, 0.0,
-      0.0, 0.0, 0.0, 1.0, 0.0, 0.0,
-      0.0, 0.0, 0.0, 0.0, 1.0, 0.0,
-      0.0, 0.0, 0.0, 0.0, 0.0, 1.0
-    },
-    *m;
+      { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 },
+      { 0.0, 1.0, 0.0, 0.0, 0.0, 0.0 },
+      { 0.0, 0.0, 1.0, 0.0, 0.0, 0.0 },
+      { 0.0, 0.0, 0.0, 1.0, 0.0, 0.0 },
+      { 0.0, 0.0, 0.0, 0.0, 1.0, 0.0 },
+      { 0.0, 0.0, 0.0, 0.0, 0.0, 1.0 }
+    };
 
   Image
     *recolor_image;
@@ -3708,9 +3704,6 @@ MagickExport Image *RecolorImage(const Image *image,const unsigned long order,
   MagickBooleanType
     status;
 
-  register const double
-    *k;
-
   register long
     i;
 
@@ -3725,24 +3718,12 @@ MagickExport Image *RecolorImage(const Image *image,const unsigned long order,
   assert(exception->signature == MagickSignature);
   if ((order < 1) || (order > 6))
     return(CloneImage(image,0,0,MagickTrue,exception));
-  for (i=0; i < 6; i++)
-    recolor_matrix[i]=(double *) NULL;
-  k=color_matrix;
+  i=0;
   for (v=0; v < (long) order; v++)
-  {
-    m=(&RecolorMatrix[6*v]);
     for (u=0; u < (long) order; u++)
-    {
-      if (*k != m[u])
-        {
-          m[u]=(*k);
-          recolor_matrix[v]=m;
-        }
-      k++;
-    }
-  }
+      recolor_matrix[v][u]=color_matrix[i++];
   /*
-    Recolor image.
+    Initialize recolor image.
   */
   recolor_image=CloneImage(image,0,0,MagickTrue,exception);
   if (recolor_image == (Image *) NULL)
@@ -3761,7 +3742,6 @@ MagickExport Image *RecolorImage(const Image *image,const unsigned long order,
 
       (void) LogMagickEvent(TransformEvent,GetMagickModule(),
         "  Recolor image with color matrix:");
-      m=RecolorMatrix;
       message=AcquireString("");
       for (v=0; v < 6; v++)
       {
@@ -3770,7 +3750,8 @@ MagickExport Image *RecolorImage(const Image *image,const unsigned long order,
         (void) ConcatenateString(&message,format);
         for (u=0; u < 6; u++)
         {
-          (void) FormatMagickString(format,MaxTextExtent,"%+f ",*m++);
+          (void) FormatMagickString(format,MaxTextExtent,"%+f ",
+            recolor_matrix[v][u]);
           (void) ConcatenateString(&message,format);
         }
         (void) LogMagickEvent(TransformEvent,GetMagickModule(),"%s",message);
@@ -3790,7 +3771,7 @@ MagickExport Image *RecolorImage(const Image *image,const unsigned long order,
   for (y=0; y < (long) image->rows; y++)
   {
     MagickRealType
-      pixels[6];
+      pixel;
 
     register const IndexPacket
       *restrict indexes;
@@ -3826,31 +3807,33 @@ MagickExport Image *RecolorImage(const Image *image,const unsigned long order,
 
       for (v=0; v < (long) order; v++)
       {
-        pixels[v]=recolor_matrix[v][0]*q->red+recolor_matrix[v][1]*q->green+
-          recolor_matrix[v][2]*q->blue;
+        pixel=recolor_matrix[v][0]*p->red+recolor_matrix[v][1]*p->green+
+          recolor_matrix[v][2]*p->blue;
         if (image->matte != MagickFalse)
-          pixels[v]+=recolor_matrix[v][3]*(QuantumRange-q->opacity);
+          pixel+=recolor_matrix[v][3]*(QuantumRange-p->opacity);
         if (image->colorspace == CMYKColorspace)
-          pixels[v]+=recolor_matrix[v][4]*indexes[x];
+          pixel+=recolor_matrix[v][4]*indexes[x];
+        pixel+=QuantumRange*recolor_matrix[v][5];
         switch (v)
         {
-          case 0: q->red=ClampToQuantum(pixels[v]); break;
-          case 1: q->green=ClampToQuantum(pixels[v]); break;
-          case 2: q->blue=ClampToQuantum(pixels[v]); break;
+          case 0: q->red=ClampToQuantum(pixel); break;
+          case 1: q->green=ClampToQuantum(pixel); break;
+          case 2: q->blue=ClampToQuantum(pixel); break;
           case 3:
           {
             if (image->matte != MagickFalse)
-              q->opacity=ClampToQuantum(QuantumRange-pixels[v]);
+              q->opacity=ClampToQuantum(QuantumRange-pixel);
             break;
           }
           case 4:
           {
             if (image->colorspace == CMYKColorspace)
-              recolor_indexes[x]=ClampToQuantum(pixels[v]);
+              recolor_indexes[x]=ClampToQuantum(pixel);
             break;
           }
         }
       }
+      p++;
       q++;
     }
     if (SyncCacheViewAuthenticPixels(recolor_view,exception) == MagickFalse)
index 8aaeed918f302d1ce94bdd75a90ad08ee84804dd..1f4f747f0da1b0e389e1a86957f4e8cc97cf2688 100644 (file)
@@ -172,7 +172,7 @@ Image Operators:
   \-raise value         lighten/darken image edges to create a 3-D effect
   \-random-threshold low,high
                        random threshold the image
-  \-recolor matrix      translate, scale, shear, or rotate image colors
+  \-recolor matrix      apply color correction to the image
   \-region geometry     apply options to a portion of the image
   \-render              render vector graphics
   \-repage geometry     size and location of an image canvas
index fd8f1a742f7636c616ac869e26bebd053afd4636..8a72a80863da6daee242acabb5eba7573b36f359 100644 (file)
@@ -173,7 +173,7 @@ Image Operators:
   \-raise value         lighten/darken image edges to create a 3-D effect
   \-random-threshold low,high
                        random threshold the image
-  \-recolor matrix      translate, scale, shear, or rotate image colors
+  \-recolor matrix      apply color correction to the image
   \-region geometry     apply options to a portion of the image
   \-render              render vector graphics
   \-repage geometry     size and location of an image canvas
index a384f8245ddac21a5fbd6dd9a74948c671d46414..d06721d6e39831d4c548f07edad6bcc33e4a4199 100644 (file)
@@ -174,7 +174,7 @@ Image Operators:
   \-raise value         lighten/darken image edges to create a 3-D effect
   \-random-threshold low,high
                        random threshold the image
-  \-recolor matrix      translate, scale, shear, or rotate image colors
+  \-recolor matrix      apply color correction to the image
   \-region geometry     apply options to a portion of the image
   \-render              render vector graphics
   \-repage geometry     size and location of an image canvas
index 7a45c66b38f1e3f1ae3a139ea5d258a465c97e8c..a7ea4555b0c5e058cff817c111718582cb31e496 100644 (file)
@@ -175,7 +175,7 @@ Image Operators:
   \-raise value         lighten/darken image edges to create a 3-D effect
   \-random-threshold low,high
                        random threshold the image
-  \-recolor matrix      translate, scale, shear, or rotate image colors
+  \-recolor matrix      apply color correction to the image
   \-region geometry     apply options to a portion of the image
   \-render              render vector graphics
   \-repage geometry     size and location of an image canvas
index 940a6bff9bb0c597c037828d590fed3633be020a..dc324c0ad866392005dd6c062877e462c7e5e3cb 100644 (file)
@@ -240,7 +240,7 @@ static MagickBooleanType ConvertUsage(void)
       "-raise value         lighten/darken image edges to create a 3-D effect",
       "-random-threshold low,high",
       "                     random threshold the image",
-      "-recolor matrix      translate, scale, shear, or rotate image colors",
+      "-recolor matrix      apply color correction to the image",
       "-region geometry     apply options to a portion of the image",
       "-render              render vector graphics",
       "-repage geometry     size and location of an image canvas",
index ccc0b21bf91966ae7ea64523772c067ddb7a0a9c..2acffb27a42405c8f1e7d76cd9ba4c9d4c541e9c 100644 (file)
@@ -8557,7 +8557,7 @@ WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
 %                                                                             %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
-%  MagickRecolorImage() translate, scale, shear, or rotate image colors.
+%  MagickRecolorImage() apply color correction to the image.
 %  Although you can use variable sized matrices, typically you use a 5 x 5 for
 %  an RGBA image and a 6x6 for CMYKA.  Populate the last row with normalized
 %  values to translate.
index 88cb1afa8f53fb207a26990ac86c41871e57176c..75b45d5fd2585a2af1705caec4ef69ed1869fec5 100644 (file)
@@ -3755,7 +3755,7 @@ static MagickBooleanType MogrifyUsage(void)
       "-raise value         lighten/darken image edges to create a 3-D effect",
       "-random-threshold low,high",
       "                     random threshold the image",
-      "-recolor matrix      translate, scale, shear, or rotate image colors",
+      "-recolor matrix      apply color correction to the image",
       "-region geometry     apply options to a portion of the image",
       "-render              render vector graphics",
       "-repage geometry     size and location of an image canvas",