]> granicus.if.org Git - imagemagick/commitdiff
Introducing MagickLevelImageColors() MagickWand method
authorCristy <urban-warrior@imagemagick.org>
Thu, 11 Jul 2019 11:27:42 +0000 (07:27 -0400)
committerCristy <urban-warrior@imagemagick.org>
Thu, 11 Jul 2019 11:27:42 +0000 (07:27 -0400)
MagickWand/magick-image.c
MagickWand/magick-image.h

index ff819d0d3570479e99e367e8025628049c9a3809..5937c2f72f1c6bae67d6137e50af9f5ace04b729 100644 (file)
@@ -6784,6 +6784,62 @@ WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
 %                                                                             %
 %                                                                             %
 %                                                                             %
+%   M a g i c k L e v e l I m a g e C o l o r s                               %
+%                                                                             %
+%                                                                             %
+%                                                                             %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%  MagickLevelImageColors() 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 separately.
+%
+%  The format of the MagickLevelImageColors method is:
+%
+%      MagickBooleanType MagickLevelImageColors(MagickWand *wand,
+%        const PixelWand *black_color,const PixelWand *white_color,
+%        const MagickBooleanType invert)
+%
+%  A description of each parameter follows:
+%
+%    o wand: the magick wand.
+%
+%    o black_color: the black color.
+%
+%    o white_color: the white color.
+%
+%    o invert: if true map the colors (levelize), rather than from (level)
+%
+*/
+WandExport MagickBooleanType MagickLevelImageColors(MagickWand *wand,
+  const PixelWand *black_color,const PixelWand *white_color,
+  const MagickBooleanType invert)
+{
+  MagickBooleanType
+    status;
+
+  PixelInfo
+    black,
+    white;
+
+  assert(wand != (MagickWand *) NULL);
+  assert(wand->signature == MagickWandSignature);
+  if (wand->debug != MagickFalse)
+    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+  if (wand->images == (Image *) NULL)
+    ThrowWandException(WandError,"ContainsNoImages",wand->name);
+  PixelGetMagickColor(black_color,&black);
+  PixelGetMagickColor(white_color,&white);
+  status=LevelImageColors(wand->images,&black,&white,invert,wand->exception);
+  return(status);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%                                                                             %
+%                                                                             %
+%                                                                             %
 %   M a g i c k L e v e l i z e I m a g e                                     %
 %                                                                             %
 %                                                                             %
index 3796e6d35dd2ea72f8ff5680f09ab52738a032f5..19e3fb8b50c482ff90d58aa5aff48de1cd940c29 100644 (file)
@@ -193,6 +193,8 @@ extern WandExport MagickBooleanType
   MagickKuwaharaImage(MagickWand *,const double,const double),
   MagickLabelImage(MagickWand *,const char *),
   MagickLevelImage(MagickWand *,const double,const double,const double),
+  MagickLevelImageColors(MagickWand *,const PixelWand *,const PixelWand *,
+    const MagickBooleanType),
   MagickLevelizeImage(MagickWand *,const double,const double,const double),
   MagickLinearStretchImage(MagickWand *,const double,const double),
   MagickLiquidRescaleImage(MagickWand *,const size_t,const size_t,const double,