]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Sat, 19 Sep 2009 00:58:29 +0000 (00:58 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sat, 19 Sep 2009 00:58:29 +0000 (00:58 +0000)
PerlMagick/Magick.xs
magick/enhance.c
magick/enhance.h
wand/convert.c
wand/mogrify.c

index 779d3a45d498835ce38056c1dfff8c7601755e33..ca28ca675422c6790e268b1bfdbc91f286d60f14 100644 (file)
@@ -516,6 +516,9 @@ static struct
       {"color-correction-collection", StringReference} } },
     { "AutoGamma", { {"channel", MagickChannelOptions} } },
     { "AutoLevel", { {"channel", MagickChannelOptions} } },
+    { "LevelColors", { {"invert", MagickBooleanOptions},
+      {"black-point", RealReference}, {"white-point", RealReference},
+      {"channel", MagickChannelOptions}, {"invert", MagickBooleanOptions} } },
   };
 
 static SplayTreeInfo
@@ -6759,6 +6762,8 @@ Mogrify(ref,...)
     AutoGammaImage     = 254
     AutoLevel          = 255
     AutoLevelImage     = 256
+    LevelColors        = 257
+    LevelColorsImage   = 258
     MogrifyRegion      = 666
   PPCODE:
   {
@@ -9939,6 +9944,26 @@ Mogrify(ref,...)
           (void) AutoLevelImageChannel(image,channel);
           break;
         }
+        case 129:  /* LevelColors */
+        {
+          MagickPixelPacket
+            black_point,
+            white_point;
+
+          (void) QueryMagickColor("#000000",&black_point,exception);
+          (void) QueryMagickColor("#ffffff",&black_point,exception);
+          if (attribute_flag[1] != 0)
+             (void) QueryMagickColor(argument_list[1].string_reference,
+               &black_point,exception);
+          if (attribute_flag[2] != 0)
+             (void) QueryMagickColor(argument_list[2].string_reference,
+               &white_point,exception);
+          if (attribute_flag[3] != 0)
+            channel=(ChannelType) argument_list[3].long_reference;
+          (void) LevelImageColors(image,channel,&black_point,&white_point,
+            argument_list[0].long_reference != 0 ? MagickTrue : MagickFalse);
+          break;
+        }
       }
       if (next != (Image *) NULL)
         (void) CatchImageException(next);
index 3e90c65aa0774e49d793a1319dff063b7206654a..5f90e6643b8bd77a0ff5094239e3558feb7fbca6 100644 (file)
@@ -2718,9 +2718,9 @@ MagickExport MagickBooleanType LevelizeImageChannel(Image *image,
 %                                                                             %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
-%  LevelImageColor() will map the given color to "black" and "white"
-%  values, limearly spreading out the colors, and level values on a channel by
-%  channel bases, as per LevelImage().  The given colors allows you to specify
+%  LevelImageColor() maps the given color to "black" and "white" values,
+%  linearly spreading out the colors, and level values on a channel by channel
+%  bases, as per LevelImage().  The given colors allows you to specify
 %  different level ranges for each of the color channels seperatally.
 %
 %  If the boolean 'invert' is set true the image values will modifyed in the
@@ -2731,9 +2731,9 @@ MagickExport MagickBooleanType LevelizeImageChannel(Image *image,
 %
 %  The format of the LevelImageColors method is:
 %
-%  MagickBooleanType LevelImageColors(Image *image,const ChannelType channel,
-%    const MagickPixelPacket *black_color,const MagickPixelPacket *white_color,
-%    const MagickBooleanType invert)
+%    MagickBooleanType LevelImageColors(Image *image,const ChannelType channel,
+%      const MagickPixelPacket *black_color,
+%      const MagickPixelPacket *white_color,const MagickBooleanType invert)
 %
 %  A description of each parameter follows:
 %
index a2ca92ec28111068b29467197261b4a8e5463502..f2759e8292df08f3951b671fa042ee8d80fb3bc4 100644 (file)
@@ -46,7 +46,7 @@ extern MagickExport MagickBooleanType
   LevelizeImageChannel(Image *,const ChannelType,const double,const double,
     const double),
   LevelImageColors(Image *,const ChannelType,const MagickPixelPacket *,
-    const MagickPixelPacket *, const MagickBooleanType),
+    const MagickPixelPacket *,const MagickBooleanType),
   LinearStretchImage(Image *,const double,const double),
   ModulateImage(Image *,const char *),
   NegateImage(Image *,const MagickBooleanType),
index f6332628def683e4d87954166b007cc3cebc06c2..aad7de920411c055965de247a61bdb4e14190870 100644 (file)
@@ -208,7 +208,7 @@ static MagickBooleanType ConvertUsage(void)
       "-layers method       optimize, merge,  or compare image layers",
       "-level value         adjust the level of image contrast",
       "-level-colors color,color",
-      "                     level image using given colors",
+      "                     level image with the given colors",
       "-linear-stretch geometry",
       "                     improve contrast by `stretching with saturation'",
       "-liquid-rescale geometry",
index 0a39345fddd8e85b8687760eb641cfac2d2c83ec..c12bf9c44b04fb4e39df5fbba2299e25f4b3603d 100644 (file)
@@ -1860,25 +1860,25 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
 
             p=(const char *) argv[i+1];
             GetMagickToken(p,&p,token);  /* get black point color */
-            if (isalpha((int) token[0]) || (token[0] == '#'))
+            if ((isalpha((int) *token) != 0) || ((*token == '#') != 0))
               (void) QueryMagickColor(token,&black_point,exception);
             else
-              (void) QueryMagickColor("black",&black_point,exception);
+              (void) QueryMagickColor("#000000",&black_point,exception);
             if (isalpha((int) token[0]) || (token[0] == '#'))
               GetMagickToken(p,&p,token);
-            if (token[0] == '\0')
+            if (*token == '\0')
               white_point=black_point; /* set everything to that color */
             else
               {
                 /*
                   Get white point color.
                 */
-                if (!(isalpha((int) token[0]) || (token[0] == '#')))
+                if ((isalpha((int) *token) == 0) && ((*token == '#') == 0))
                   GetMagickToken(p,&p,token);
-                if ((isalpha((int) token[0]) || (token[0] == '#')))
+                if ((isalpha((int) *token) != 0) || ((*token == '#') != 0))
                   (void) QueryMagickColor(token,&white_point,exception);
                 else
-                  (void) QueryMagickColor("white",&white_point,exception);
+                  (void) QueryMagickColor("#ffffff",&white_point,exception);
               }
             (void) LevelImageColors(*image,channel,&black_point,&white_point,
               *option == '+' ? MagickTrue : MagickFalse);
@@ -3496,7 +3496,7 @@ static MagickBooleanType MogrifyUsage(void)
       "-layers method       optimize, merge,  or compare image layers",
       "-level value         adjust the level of image contrast",
       "-level-colors color,color",
-      "                     level image using given colors",
+      "                     level image with the given colors",
       "-linear-stretch geometry",
       "                     improve contrast by `stretching with saturation'",
       "-liquid-rescale geometry",