diff --git a/Magick++/lib/Image.cpp b/Magick++/lib/Image.cpp
index 8ff63b8..f1a7495 100644
--- a/Magick++/lib/Image.cpp
+++ b/Magick++/lib/Image.cpp
@@ -1133,11 +1133,8 @@
// Gamma correct image
void Magick::Image::gamma ( const double gamma_ )
{
- char gamma[MaxTextExtent + 1];
- FormatLocaleString( gamma, MaxTextExtent, "%3.6f", gamma_);
-
modifyImage();
- GammaImage ( image(), gamma );
+ GammaImage ( image(), gamma_ );
}
void Magick::Image::gamma ( const double gammaRed_,
@@ -1149,7 +1146,7 @@
gammaRed_, gammaGreen_, gammaBlue_);
modifyImage();
- GammaImage ( image(), gamma );
+ GammaImage ( image(), atof(gamma) );
throwImageException();
}
diff --git a/MagickCore/display.c b/MagickCore/display.c
index 7f19bf4..00f7623 100644
--- a/MagickCore/display.c
+++ b/MagickCore/display.c
@@ -7762,7 +7762,7 @@
Query user for gamma value.
*/
(void) XDialogWidget(display,windows,"Gamma",
- "Enter gamma value (e.g. 1.0,1.0,1.6):",factor);
+ "Enter gamma value (e.g. 1.2):",factor);
if (*factor == '\0')
break;
/*
@@ -7770,7 +7770,7 @@
*/
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
- (void) GammaImage(*image,factor);
+ (void) GammaImage(*image,atof(factor));
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
@@ -7838,8 +7838,7 @@
white_point*=(double) (*image)->columns*(*image)->rows/100.0;
}
white_point=(MagickRealType) (*image)->columns*(*image)->rows-white_point;
- (void) ContrastStretchImageChannel(*image,DefaultChannels,black_point,
- white_point);
+ (void) ContrastStretchImage(*image,black_point,white_point);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
diff --git a/MagickCore/effect.c b/MagickCore/effect.c
index 13a2ddf..46bb6a3 100644
--- a/MagickCore/effect.c
+++ b/MagickCore/effect.c
@@ -2897,7 +2897,7 @@
if (preview_image == (Image *) NULL)
break;
gamma+=0.4f;
- (void) GammaImageChannel(preview_image,DefaultChannels,gamma);
+ (void) GammaImage(preview_image,gamma);
(void) FormatLocaleString(label,MaxTextExtent,"gamma %g",gamma);
break;
}
diff --git a/MagickCore/enhance.c b/MagickCore/enhance.c
index 9b70abb..3cee6df 100644
--- a/MagickCore/enhance.c
+++ b/MagickCore/enhance.c
@@ -1013,16 +1013,11 @@
%
% MagickBooleanType ContrastStretchImage(Image *image,
% const char *levels)
-% MagickBooleanType ContrastStretchImageChannel(Image *image,
-% const size_t channel,const double black_point,
-% const double white_point)
%
% A description of each parameter follows:
%
% o image: the image.
%
-% o channel: the channel.
-%
% o black_point: the black point.
%
% o white_point: the white point.
@@ -1031,47 +1026,8 @@
% range of 0 to number-of-pixels (e.g. 1%, 10x90%, etc.).
%
*/
-
MagickExport MagickBooleanType ContrastStretchImage(Image *image,
- const char *levels)
-{
- double
- black_point,
- white_point;
-
- GeometryInfo
- geometry_info;
-
- MagickBooleanType
- status;
-
- MagickStatusType
- flags;
-
- /*
- Parse levels.
- */
- if (levels == (char *) NULL)
- return(MagickFalse);
- flags=ParseGeometry(levels,&geometry_info);
- black_point=geometry_info.rho;
- white_point=(double) image->columns*image->rows;
- if ((flags & SigmaValue) != 0)
- white_point=geometry_info.sigma;
- if ((flags & PercentValue) != 0)
- {
- black_point*=(double) QuantumRange/100.0;
- white_point*=(double) QuantumRange/100.0;
- }
- if ((flags & SigmaValue) == 0)
- white_point=(double) image->columns*image->rows-black_point;
- status=ContrastStretchImageChannel(image,DefaultChannels,black_point,
- white_point);
- return(status);
-}
-
-MagickExport MagickBooleanType ContrastStretchImageChannel(Image *image,
- const ChannelType channel,const double black_point,const double white_point)
+ const double black_point,const double white_point)
{
#define MaxRange(color) ((MagickRealType) ScaleQuantumToMap((Quantum) (color)))
#define ContrastStretchImageTag "ContrastStretch/Image"
@@ -1141,7 +1097,7 @@
status=MagickFalse;
continue;
}
- if (channel == DefaultChannels)
+ if (image->sync != MagickFalse)
for (x=0; x < (ssize_t) image->columns; x++)
{
Quantum
@@ -1464,7 +1420,7 @@
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_ContrastStretchImageChannel)
+ #pragma omp critical (MagickCore_ContrastStretchImage)
#endif
proceed=SetImageProgress(image,ContrastStretchImageTag,progress++,
image->rows);
@@ -1690,8 +1646,6 @@
% The format of the EqualizeImage method is:
%
% MagickBooleanType EqualizeImage(Image *image)
-% MagickBooleanType EqualizeImageChannel(Image *image,
-% const ChannelType channel)
%
% A description of each parameter follows:
%
@@ -1700,15 +1654,8 @@
% o channel: the channel.
%
*/
-
MagickExport MagickBooleanType EqualizeImage(Image *image)
{
- return(EqualizeImageChannel(image,DefaultChannels));
-}
-
-MagickExport MagickBooleanType EqualizeImageChannel(Image *image,
- const ChannelType channel)
-{
#define EqualizeImageTag "Equalize/Image"
CacheView
@@ -1933,7 +1880,7 @@
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_EqualizeImageChannel)
+ #pragma omp critical (MagickCore_EqualizeImage)
#endif
proceed=SetImageProgress(image,EqualizeImageTag,progress++,image->rows);
if (proceed == MagickFalse)
@@ -1967,63 +1914,18 @@
%
% The format of the GammaImage method is:
%
-% MagickBooleanType GammaImage(Image *image,const char *level)
-% MagickBooleanType GammaImageChannel(Image *image,
-% const ChannelType channel,const double gamma)
+% MagickBooleanType GammaImage(Image *image,const double gamma)
%
% A description of each parameter follows:
%
% o image: the image.
%
-% o channel: the channel.
-%
% o level: the image gamma as a string (e.g. 1.6,1.2,1.0).
%
% o gamma: the image gamma.
%
*/
-MagickExport MagickBooleanType GammaImage(Image *image,const char *level)
-{
- GeometryInfo
- geometry_info;
-
- PixelInfo
- gamma;
-
- MagickStatusType
- flags,
- status;
-
- assert(image != (Image *) NULL);
- assert(image->signature == MagickSignature);
- if (image->debug != MagickFalse)
- (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
- if (level == (char *) NULL)
- return(MagickFalse);
- flags=ParseGeometry(level,&geometry_info);
- gamma.red=geometry_info.rho;
- gamma.green=geometry_info.sigma;
- if ((flags & SigmaValue) == 0)
- gamma.green=gamma.red;
- gamma.blue=geometry_info.xi;
- if ((flags & XiValue) == 0)
- gamma.blue=gamma.red;
- if ((gamma.red == 1.0) && (gamma.green == 1.0) && (gamma.blue == 1.0))
- return(MagickTrue);
- if ((gamma.red == gamma.green) && (gamma.green == gamma.blue))
- status=GammaImageChannel(image,(const ChannelType) (RedChannel |
- GreenChannel | BlueChannel),(double) gamma.red);
- else
- {
- status=GammaImageChannel(image,RedChannel,(double) gamma.red);
- status|=GammaImageChannel(image,GreenChannel,(double) gamma.green);
- status|=GammaImageChannel(image,BlueChannel,(double) gamma.blue);
- }
- return(status != 0 ? MagickTrue : MagickFalse);
-}
-
-MagickExport MagickBooleanType GammaImageChannel(Image *image,
- const ChannelType channel,const double gamma)
+MagickExport MagickBooleanType GammaImage(Image *image,const double gamma)
{
#define GammaCorrectImageTag "GammaCorrect/Image"
@@ -2121,12 +2023,12 @@
}
for (x=0; x < (ssize_t) image->columns; x++)
{
- if (channel == DefaultChannels)
+ if (image->sync != MagickFalse)
{
- SetPixelRed(image,gamma_map[
- ScaleQuantumToMap(GetPixelRed(image,q))],q);
- SetPixelGreen(image,gamma_map[
- ScaleQuantumToMap(GetPixelGreen(image,q))],q);
+ SetPixelRed(image,gamma_map[ScaleQuantumToMap(
+ GetPixelRed(image,q))],q);
+ SetPixelGreen(image,gamma_map[ScaleQuantumToMap(
+ GetPixelGreen(image,q))],q);
SetPixelBlue(image,gamma_map[ScaleQuantumToMap(
GetPixelBlue(image,q))],q);
}
@@ -2166,7 +2068,7 @@
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_GammaImageChannel)
+ #pragma omp critical (MagickCore_GammaImage)
#endif
proceed=SetImageProgress(image,GammaCorrectImageTag,progress++,
image->rows);
@@ -2407,7 +2309,7 @@
%
% If a '!' flag is given, map black and white colors to the given levels
% rather than mapping those levels to black and white. See
-% LevelizeImageChannel() and LevelizeImageChannel(), below.
+% LevelizeImage() below.
%
% Gamma specifies a gamma correction to apply to the image.
%
@@ -2555,12 +2457,12 @@
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% LevelizeImageChannel() applies the reversed LevelImage() operation to just
+% LevelizeImage() applies the reversed LevelImage() operation to just
% the specific channels specified. It compresses the full range of color
% values, so that they lie between the given black and white points. Gamma is
% applied before the values are mapped.
%
-% LevelizeImageChannel() can be called with by using a +level command line
+% LevelizeImage() can be called with by using a +level command line
% API option, or using a '!' on a -level or LevelImage() geometry string.
%
% It can be used for example de-contrast a greyscale image to the exact
@@ -2568,17 +2470,15 @@
% you can convert a gray-scale image to any linear color gradient, according
% to those levels.
%
-% The format of the LevelizeImageChannel method is:
+% The format of the LevelizeImage method is:
%
-% MagickBooleanType LevelizeImageChannel(Image *image,
-% const ChannelType channel,const char *levels)
+% MagickBooleanType LevelizeImage(Image *image,const double black_point,
+% const double white_point,const double gamma)
%
% A description of each parameter follows:
%
% o image: the image.
%
-% o channel: the channel.
-%
% o black_point: The level to map zero (black) to.
%
% o white_point: The level to map QuantiumRange (white) to.
@@ -2586,25 +2486,12 @@
% o gamma: adjust gamma by this factor before mapping values.
%
*/
-
MagickExport MagickBooleanType LevelizeImage(Image *image,
const double black_point,const double white_point,const double gamma)
{
- MagickBooleanType
- status;
-
- status=LevelizeImageChannel(image,DefaultChannels,black_point,white_point,
- gamma);
- return(status);
-}
-
-MagickExport MagickBooleanType LevelizeImageChannel(Image *image,
- const ChannelType channel,const double black_point,const double white_point,
- const double gamma)
-{
#define LevelizeImageTag "Levelize/Image"
#define LevelizeValue(x) (ClampToQuantum(((MagickRealType) \
- pow((double)(QuantumScale*(x)),1.0/gamma))*(white_point-black_point)+ \
+ pow((double) (QuantumScale*(x)),1.0/gamma))*(white_point-black_point)+ \
black_point))
CacheView
@@ -2700,7 +2587,7 @@
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_LevelizeImageChannel)
+ #pragma omp critical (MagickCore_LevelizeImage)
#endif
proceed=SetImageProgress(image,LevelizeImageTag,progress++,image->rows);
if (proceed == MagickFalse)
@@ -2818,34 +2705,32 @@
if ((GetPixelRedTraits(image) & ActivePixelTrait) != 0)
{
SetPixelComponentMap(image,RedChannel);
- status|=LevelizeImageChannel(image,RedChannel,
- black_color->red,white_color->red,(double) 1.0);
+ status|=LevelizeImage(image,black_color->red,white_color->red,1.0);
}
if ((GetPixelGreenTraits(image) & ActivePixelTrait) != 0)
{
SetPixelComponentMap(image,GreenChannel);
- status|=LevelizeImageChannel(image,GreenChannel,
- black_color->green,white_color->green,(double) 1.0);
+ status|=LevelizeImage(image,black_color->green,white_color->green,
+ 1.0);
}
if ((GetPixelBlueTraits(image) & ActivePixelTrait) != 0)
{
SetPixelComponentMap(image,BlueChannel);
- status|=LevelizeImageChannel(image,BlueChannel,
- black_color->blue,white_color->blue,(double) 1.0);
+ status|=LevelizeImage(image,black_color->blue,white_color->blue,1.0);
}
if (((GetPixelBlackTraits(image) & ActivePixelTrait) != 0) &&
(image->colorspace == CMYKColorspace))
{
SetPixelComponentMap(image,BlackChannel);
- status|=LevelizeImageChannel(image,BlackChannel,
- black_color->black,white_color->black,(double) 1.0);
+ status|=LevelizeImage(image,black_color->black,white_color->black,
+ 1.0);
}
if (((GetPixelAlphaTraits(image) & ActivePixelTrait) != 0) &&
(image->matte == MagickTrue))
{
SetPixelComponentMap(image,AlphaChannel);
- status|=LevelizeImageChannel(image,OpacityChannel,
- black_color->alpha,white_color->alpha,(double) 1.0);
+ status|=LevelizeImage(image,black_color->alpha,white_color->alpha,
+ 1.0);
}
}
SetPixelComponentMap(image,DefaultChannels);
@@ -3252,36 +3137,21 @@
% NegateImage() negates the colors in the reference image. The grayscale
% option means that only grayscale values within the image are negated.
%
-% The format of the NegateImageChannel method is:
+% The format of the NegateImage method is:
%
% MagickBooleanType NegateImage(Image *image,
% const MagickBooleanType grayscale)
-% MagickBooleanType NegateImageChannel(Image *image,
-% const ChannelType channel,const MagickBooleanType grayscale)
%
% A description of each parameter follows:
%
% o image: the image.
%
-% o channel: the channel.
-%
% o grayscale: If MagickTrue, only negate grayscale pixels within the image.
%
*/
-
MagickExport MagickBooleanType NegateImage(Image *image,
const MagickBooleanType grayscale)
{
- MagickBooleanType
- status;
-
- status=NegateImageChannel(image,DefaultChannels,grayscale);
- return(status);
-}
-
-MagickExport MagickBooleanType NegateImageChannel(Image *image,
- const ChannelType channel,const MagickBooleanType grayscale)
-{
#define NegateImageTag "Negate/Image"
CacheView
@@ -3393,7 +3263,7 @@
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_NegateImageChannel)
+ #pragma omp critical (MagickCore_NegateImage)
#endif
proceed=SetImageProgress(image,NegateImageTag,progress++,
image->rows);
@@ -3449,7 +3319,7 @@
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_NegateImageChannel)
+ #pragma omp critical (MagickCore_NegateImage)
#endif
proceed=SetImageProgress(image,NegateImageTag,progress++,image->rows);
if (proceed == MagickFalse)
@@ -3478,36 +3348,21 @@
% The format of the NormalizeImage method is:
%
% MagickBooleanType NormalizeImage(Image *image)
-% MagickBooleanType NormalizeImageChannel(Image *image,
-% const ChannelType channel)
%
% A description of each parameter follows:
%
% o image: the image.
%
-% o channel: the channel.
-%
*/
-
MagickExport MagickBooleanType NormalizeImage(Image *image)
{
- MagickBooleanType
- status;
-
- status=NormalizeImageChannel(image,DefaultChannels);
- return(status);
-}
-
-MagickExport MagickBooleanType NormalizeImageChannel(Image *image,
- const ChannelType channel)
-{
double
black_point,
white_point;
black_point=(double) image->columns*image->rows*0.0015;
white_point=(double) image->columns*image->rows*0.9995;
- return(ContrastStretchImageChannel(image,channel,black_point,white_point));
+ return(ContrastStretchImage(image,black_point,white_point));
}
/*
diff --git a/MagickCore/enhance.h b/MagickCore/enhance.h
index 31f25c0..635902c 100644
--- a/MagickCore/enhance.h
+++ b/MagickCore/enhance.h
@@ -29,18 +29,12 @@
ClutImage(Image *,const Image *),
ColorDecisionListImage(Image *,const char *),
ContrastImage(Image *,const MagickBooleanType),
- ContrastStretchImage(Image *,const char *),
- ContrastStretchImageChannel(Image *,const ChannelType,const double,
- const double),
+ ContrastStretchImage(Image *,const double,const double),
EqualizeImage(Image *image),
- EqualizeImageChannel(Image *image,const ChannelType),
- GammaImage(Image *,const char *),
- GammaImageChannel(Image *,const ChannelType,const double),
+ GammaImage(Image *,const double),
HaldClutImage(Image *,const Image *),
LevelImage(Image *,const double,const double,const double),
LevelizeImage(Image *,const double,const double,const double),
- LevelizeImageChannel(Image *,const ChannelType,const double,const double,
- const double),
LevelColorsImage(Image *,const PixelInfo *,const PixelInfo *,
const MagickBooleanType),
LevelColorsImageChannel(Image *,const ChannelType,const PixelInfo *,
@@ -48,9 +42,7 @@
LinearStretchImage(Image *,const double,const double),
ModulateImage(Image *,const char *),
NegateImage(Image *,const MagickBooleanType),
- NegateImageChannel(Image *,const ChannelType,const MagickBooleanType),
NormalizeImage(Image *),
- NormalizeImageChannel(Image *,const ChannelType),
SigmoidalContrastImage(Image *,const MagickBooleanType,const double,
const double);
diff --git a/MagickCore/methods.h b/MagickCore/methods.h
index abc5a51..fb8101f 100644
--- a/MagickCore/methods.h
+++ b/MagickCore/methods.h
@@ -207,7 +207,7 @@
#define ConstituteImage PrependMagickMethod(ConstituteImage)
#define ContinueTimer PrependMagickMethod(ContinueTimer)
#define ContrastImage PrependMagickMethod(ContrastImage)
-#define ContrastStretchImageChannel PrependMagickMethod(ContrastStretchImageChannel)
+#define ContrastStretchImage PrependMagickMethod(ContrastStretchImage)
#define ContrastStretchImage PrependMagickMethod(ContrastStretchImage)
#define ConvertHSBToRGB PrependMagickMethod(ConvertHSBToRGB)
#define ConvertHSLToRGB PrependMagickMethod(ConvertHSLToRGB)
@@ -306,7 +306,7 @@
#define EncipherImage PrependMagickMethod(EncipherImage)
#define EnhanceImage PrependMagickMethod(EnhanceImage)
#define EOFBlob PrependMagickMethod(EOFBlob)
-#define EqualizeImageChannel PrependMagickMethod(EqualizeImageChannel)
+#define EqualizeImage PrependMagickMethod(EqualizeImage)
#define EqualizeImage PrependMagickMethod(EqualizeImage)
#define EscapeString PrependMagickMethod(EscapeString)
#define EvaluateImageChannel PrependMagickMethod(EvaluateImageChannel)
@@ -353,7 +353,7 @@
#define FxImageChannel PrependMagickMethod(FxImageChannel)
#define FxImage PrependMagickMethod(FxImage)
#define FxPreprocessExpression PrependMagickMethod(FxPreprocessExpression)
-#define GammaImageChannel PrependMagickMethod(GammaImageChannel)
+#define GammaImage PrependMagickMethod(GammaImage)
#define GammaImage PrependMagickMethod(GammaImage)
#define GaussianBlurImageChannel PrependMagickMethod(GaussianBlurImageChannel)
#define GaussianBlurImage PrependMagickMethod(GaussianBlurImage)
@@ -687,7 +687,7 @@
#define LevelImage PrependMagickMethod(LevelImage)
#define LevelImageColors PrependMagickMethod(LevelImageColors)
#define LevelImage PrependMagickMethod(LevelImage)
-#define LevelizeImageChannel PrependMagickMethod(LevelizeImageChannel)
+#define LevelizeImage PrependMagickMethod(LevelizeImage)
#define LevelizeImage PrependMagickMethod(LevelizeImage)
#define LiberateMemory PrependMagickMethod(LiberateMemory)
#define LiberateSemaphoreInfo PrependMagickMethod(LiberateSemaphoreInfo)
@@ -765,7 +765,7 @@
#define MSBOrderLong PrependMagickMethod(MSBOrderLong)
#define MSBOrderShort PrependMagickMethod(MSBOrderShort)
#define MultilineCensus PrependMagickMethod(MultilineCensus)
-#define NegateImageChannel PrependMagickMethod(NegateImageChannel)
+#define NegateImage PrependMagickMethod(NegateImage)
#define NegateImage PrependMagickMethod(NegateImage)
#define NewHashmap PrependMagickMethod(NewHashmap)
#define NewImageList PrependMagickMethod(NewImageList)
@@ -774,7 +774,7 @@
#define NewSplayTree PrependMagickMethod(NewSplayTree)
#define NewXMLTree PrependMagickMethod(NewXMLTree)
#define NewXMLTreeTag PrependMagickMethod(NewXMLTreeTag)
-#define NormalizeImageChannel PrependMagickMethod(NormalizeImageChannel)
+#define NormalizeImage PrependMagickMethod(NormalizeImage)
#define NormalizeImage PrependMagickMethod(NormalizeImage)
#define OilPaintImage PrependMagickMethod(OilPaintImage)
#define OpaqueImage PrependMagickMethod(OpaqueImage)
diff --git a/MagickCore/montage.c b/MagickCore/montage.c
index bebb2e3..6b23d9f 100644
--- a/MagickCore/montage.c
+++ b/MagickCore/montage.c
@@ -757,7 +757,11 @@
}
if ((montage_info->frame != (char *) NULL) &&
(image->compose == DstOutCompositeOp))
- (void) NegateImageChannel(image,OpacityChannel,MagickFalse);
+ {
+ SetPixelComponentMap(image,AlphaChannel);
+ (void) NegateImage(image,MagickFalse);
+ SetPixelComponentMap(image,DefaultChannels);
+ }
}
/*
Gravitate as specified by the tile gravity.
diff --git a/MagickWand/magick-image.c b/MagickWand/magick-image.c
index bbbb390..bd4197b 100644
--- a/MagickWand/magick-image.c
+++ b/MagickWand/magick-image.c
@@ -1938,47 +1938,29 @@
%
% MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
% const double black_point,const double white_point)
-% MagickBooleanType MagickContrastStretchImageChannel(MagickWand *wand,
-% const ChannelType channel,const double black_point,
-% const double white_point)
%
% A description of each parameter follows:
%
% o wand: the magick wand.
%
-% o channel: the image channel(s).
-%
% o black_point: the black point.
%
% o white_point: the white point.
%
*/
-
WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
const double black_point,const double white_point)
{
MagickBooleanType
status;
- status=MagickContrastStretchImageChannel(wand,DefaultChannels,black_point,
- white_point);
- return(status);
-}
-
-WandExport MagickBooleanType MagickContrastStretchImageChannel(MagickWand *wand,
- const ChannelType channel,const double black_point,const double white_point)
-{
- MagickBooleanType
- status;
-
assert(wand != (MagickWand *) NULL);
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
if (wand->images == (Image *) NULL)
ThrowWandException(WandError,"ContainsNoImages",wand->name);
- status=ContrastStretchImageChannel(wand->images,channel,black_point,
- white_point);
+ status=ContrastStretchImage(wand->images,black_point,white_point);
if (status == MagickFalse)
InheritException(wand->exception,&wand->images->exception);
return(status);
@@ -2837,8 +2819,6 @@
% The format of the MagickEqualizeImage method is:
%
% MagickBooleanType MagickEqualizeImage(MagickWand *wand)
-% MagickBooleanType MagickEqualizeImageChannel(MagickWand *wand,
-% const ChannelType channel)
%
% A description of each parameter follows:
%
@@ -2847,29 +2827,18 @@
% o channel: the image channel(s).
%
*/
-
WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
{
MagickBooleanType
status;
- status=MagickEqualizeImageChannel(wand,DefaultChannels);
- return(status);
-}
-
-WandExport MagickBooleanType MagickEqualizeImageChannel(MagickWand *wand,
- const ChannelType channel)
-{
- MagickBooleanType
- status;
-
assert(wand != (MagickWand *) NULL);
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
if (wand->images == (Image *) NULL)
ThrowWandException(WandError,"ContainsNoImages",wand->name);
- status=EqualizeImageChannel(wand->images,channel);
+ status=EqualizeImage(wand->images);
if (status == MagickFalse)
InheritException(wand->exception,&wand->images->exception);
return(status);
@@ -3595,42 +3564,27 @@
% The format of the MagickGammaImage method is:
%
% MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
-% MagickBooleanType MagickGammaImageChannel(MagickWand *wand,
-% const ChannelType channel,const double gamma)
%
% A description of each parameter follows:
%
% o wand: the magick wand.
%
-% o channel: the channel.
-%
% o level: Define the level of gamma correction.
%
*/
-
WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
const double gamma)
{
MagickBooleanType
status;
- status=MagickGammaImageChannel(wand,DefaultChannels,gamma);
- return(status);
-}
-
-WandExport MagickBooleanType MagickGammaImageChannel(MagickWand *wand,
- const ChannelType channel,const double gamma)
-{
- MagickBooleanType
- status;
-
assert(wand != (MagickWand *) NULL);
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
if (wand->images == (Image *) NULL)
ThrowWandException(WandError,"ContainsNoImages",wand->name);
- status=GammaImageChannel(wand->images,channel,gamma);
+ status=GammaImage(wand->images,gamma);
if (status == MagickFalse)
InheritException(wand->exception,&wand->images->exception);
return(status);
@@ -7048,42 +7002,27 @@
%
% MagickBooleanType MagickNegateImage(MagickWand *wand,
% const MagickBooleanType gray)
-% MagickBooleanType MagickNegateImage(MagickWand *wand,
-% const ChannelType channel,const MagickBooleanType gray)
%
% A description of each parameter follows:
%
% o wand: the magick wand.
%
-% o channel: the image channel(s).
-%
% o gray: If MagickTrue, only negate grayscale pixels within the image.
%
*/
-
WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
const MagickBooleanType gray)
{
MagickBooleanType
status;
- status=MagickNegateImageChannel(wand,DefaultChannels,gray);
- return(status);
-}
-
-WandExport MagickBooleanType MagickNegateImageChannel(MagickWand *wand,
- const ChannelType channel,const MagickBooleanType gray)
-{
- MagickBooleanType
- status;
-
assert(wand != (MagickWand *) NULL);
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
if (wand->images == (Image *) NULL)
ThrowWandException(WandError,"ContainsNoImages",wand->name);
- status=NegateImageChannel(wand->images,channel,gray);
+ status=NegateImage(wand->images,gray);
if (status == MagickFalse)
InheritException(wand->exception,&wand->images->exception);
return(status);
@@ -7208,39 +7147,24 @@
% The format of the MagickNormalizeImage method is:
%
% MagickBooleanType MagickNormalizeImage(MagickWand *wand)
-% MagickBooleanType MagickNormalizeImageChannel(MagickWand *wand,
-% const ChannelType channel)
%
% A description of each parameter follows:
%
% o wand: the magick wand.
%
-% o channel: the image channel(s).
-%
*/
-
WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
{
MagickBooleanType
status;
- status=MagickNormalizeImageChannel(wand,DefaultChannels);
- return(status);
-}
-
-WandExport MagickBooleanType MagickNormalizeImageChannel(MagickWand *wand,
- const ChannelType channel)
-{
- MagickBooleanType
- status;
-
assert(wand != (MagickWand *) NULL);
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
if (wand->images == (Image *) NULL)
ThrowWandException(WandError,"ContainsNoImages",wand->name);
- status=NormalizeImageChannel(wand->images,channel);
+ status=NormalizeImage(wand->images);
if (status == MagickFalse)
InheritException(wand->exception,&wand->images->exception);
return(status);
diff --git a/MagickWand/magick-image.h b/MagickWand/magick-image.h
index c95b6a0..96b5e96 100644
--- a/MagickWand/magick-image.h
+++ b/MagickWand/magick-image.h
@@ -115,8 +115,6 @@
const StorageType,const void *),
MagickContrastImage(MagickWand *,const MagickBooleanType),
MagickContrastStretchImage(MagickWand *,const double,const double),
- MagickContrastStretchImageChannel(MagickWand *,const ChannelType,const double,
- const double),
MagickConvolveImage(MagickWand *,const size_t,const double *),
MagickConvolveImageChannel(MagickWand *,const ChannelType,const size_t,
const double *),
@@ -136,7 +134,6 @@
MagickEncipherImage(MagickWand *,const char *),
MagickEnhanceImage(MagickWand *),
MagickEqualizeImage(MagickWand *),
- MagickEqualizeImageChannel(MagickWand *,const ChannelType),
MagickEvaluateImage(MagickWand *,const MagickEvaluateOperator,const double),
MagickEvaluateImageChannel(MagickWand *,const ChannelType,
const MagickEvaluateOperator,const double),
@@ -159,7 +156,6 @@
MagickFunctionImageChannel(MagickWand *,const ChannelType,
const MagickFunction,const size_t,const double *),
MagickGammaImage(MagickWand *,const double),
- MagickGammaImageChannel(MagickWand *,const ChannelType,const double),
MagickGaussianBlurImage(MagickWand *,const double,const double),
MagickGaussianBlurImageChannel(MagickWand *,const ChannelType,const double,
const double),
@@ -211,12 +207,9 @@
MagickMotionBlurImageChannel(MagickWand *,const ChannelType,const double,
const double,const double),
MagickNegateImage(MagickWand *,const MagickBooleanType),
- MagickNegateImageChannel(MagickWand *,const ChannelType,
- const MagickBooleanType),
MagickNewImage(MagickWand *,const size_t,const size_t,const PixelWand *),
MagickNextImage(MagickWand *),
MagickNormalizeImage(MagickWand *),
- MagickNormalizeImageChannel(MagickWand *,const ChannelType),
MagickOilPaintImage(MagickWand *,const double),
MagickOpaquePaintImage(MagickWand *,const PixelWand *,const PixelWand *,
const double,const MagickBooleanType),
diff --git a/MagickWand/mogrify.c b/MagickWand/mogrify.c
index 5065193..08f83ad 100644
--- a/MagickWand/mogrify.c
+++ b/MagickWand/mogrify.c
@@ -1186,8 +1186,7 @@
}
white_point=(MagickRealType) (*image)->columns*(*image)->rows-
white_point;
- (void) ContrastStretchImageChannel(*image,channel,black_point,
- white_point);
+ (void) ContrastStretchImage(*image,black_point,white_point);
InheritException(exception,&(*image)->exception);
break;
}
@@ -1484,7 +1483,7 @@
Equalize image.
*/
(void) SyncImageSettings(mogrify_info,*image);
- (void) EqualizeImageChannel(*image,channel);
+ (void) EqualizeImage(*image);
InheritException(exception,&(*image)->exception);
break;
}
@@ -1712,11 +1711,8 @@
(*image)->gamma=InterpretLocaleValue(argv[i+1],(char **) NULL);
else
{
- if (strchr(argv[i+1],',') != (char *) NULL)
- (void) GammaImage(*image,argv[i+1]);
- else
- (void) GammaImageChannel(*image,channel,
- InterpretLocaleValue(argv[i+1],(char **) NULL));
+ (void) GammaImage(*image,InterpretLocaleValue(argv[i+1],
+ (char **) NULL));
InheritException(exception,&(*image)->exception);
}
break;
@@ -1889,8 +1885,7 @@
if ((flags & SigmaValue) == 0)
white_point=(MagickRealType) QuantumRange-black_point;
if ((*option == '+') || ((flags & AspectValue) != 0))
- (void) LevelizeImageChannel(*image,channel,black_point,
- white_point,gamma);
+ (void) LevelizeImage(*image,black_point,white_point,gamma);
else
(void) LevelImage(*image,black_point,white_point,gamma);
InheritException(exception,&(*image)->exception);
@@ -2152,8 +2147,8 @@
if (LocaleCompare("negate",option+1) == 0)
{
(void) SyncImageSettings(mogrify_info,*image);
- (void) NegateImageChannel(*image,channel,*option == '+' ?
- MagickTrue : MagickFalse);
+ (void) NegateImage(*image,*option == '+' ? MagickTrue :
+ MagickFalse);
InheritException(exception,&(*image)->exception);
break;
}
@@ -2182,7 +2177,7 @@
if (LocaleCompare("normalize",option+1) == 0)
{
(void) SyncImageSettings(mogrify_info,*image);
- (void) NormalizeImageChannel(*image,channel);
+ (void) NormalizeImage(*image);
InheritException(exception,&(*image)->exception);
break;
}
diff --git a/PerlMagick/Magick.xs b/PerlMagick/Magick.xs
index 77046e1..8c7aafa 100644
--- a/PerlMagick/Magick.xs
+++ b/PerlMagick/Magick.xs
@@ -8624,8 +8624,11 @@
case 39: /* Equalize */
{
if (attribute_flag[0] != 0)
- channel=(ChannelType) argument_list[0].integer_reference;
- EqualizeImageChannel(image,channel);
+ {
+ channel=(ChannelType) argument_list[0].integer_reference;
+ SetPixelComponentMap(image,channel);
+ }
+ EqualizeImage(image);
break;
}
case 40: /* Gamma */
@@ -8646,11 +8649,8 @@
(double) argument_list[4].real_reference);
argument_list[0].string_reference=message;
}
- if (strchr(argument_list[0].string_reference,',') != (char *) NULL)
- (void) GammaImage(image,argument_list[0].string_reference);
- else
- (void) GammaImageChannel(image,channel,InterpretLocaleValue(
- argument_list[0].string_reference,(char **) NULL));
+ (void) GammaImage(image,InterpretLocaleValue(
+ argument_list[0].string_reference,(char **) NULL));
break;
}
case 41: /* Map */
@@ -8764,16 +8764,22 @@
if (attribute_flag[0] == 0)
argument_list[0].integer_reference=0;
if (attribute_flag[1] != 0)
- channel=(ChannelType) argument_list[1].integer_reference;
- (void) NegateImageChannel(image,channel,
- argument_list[0].integer_reference != 0 ? MagickTrue : MagickFalse);
+ {
+ channel=(ChannelType) argument_list[1].integer_reference;
+ SetPixelComponentMap(image,channel);
+ }
+ (void) NegateImage(image,argument_list[0].integer_reference != 0 ?
+ MagickTrue : MagickFalse);
break;
}
case 45: /* Normalize */
{
if (attribute_flag[0] != 0)
- channel=(ChannelType) argument_list[0].integer_reference;
- NormalizeImageChannel(image,channel);
+ {
+ channel=(ChannelType) argument_list[0].integer_reference;
+ SetPixelComponentMap(image,channel);
+ }
+ NormalizeImage(image);
break;
}
case 46: /* NumberColors */
@@ -9812,9 +9818,11 @@
if (attribute_flag[2] != 0)
white_point=argument_list[2].real_reference;
if (attribute_flag[4] != 0)
- channel=(ChannelType) argument_list[4].integer_reference;
- (void) ContrastStretchImageChannel(image,channel,black_point,
- white_point);
+ {
+ channel=(ChannelType) argument_list[4].integer_reference;
+ SetPixelComponentMap(image,channel);
+ }
+ (void) ContrastStretchImage(image,black_point,white_point);
break;
}
case 96: /* Sans0 */
@@ -10153,9 +10161,11 @@
goto PerlException;
}
if (attribute_flag[1] != 0)
- channel=(ChannelType) argument_list[1].integer_reference;
- (void) ClutImage(image,channel,
- argument_list[0].image_reference);
+ {
+ channel=(ChannelType) argument_list[1].integer_reference;
+ SetPixelComponentMap(image,channel);
+ }
+ (void) ClutImage(image,argument_list[0].image_reference);
break;
}
case 114: /* LiquidRescale */
@@ -13211,7 +13221,6 @@
goto PerlException;
}
av=(AV *) NULL;
- channel=DefaultChannels;
normalize=MagickTrue;
region.x=0;
region.y=0;
@@ -13239,7 +13248,7 @@
SvPV(ST(i),na));
return;
}
- channel=(ChannelType) option;
+ channel=(ChannelType) option;
break;
}
if (LocaleCompare(attribute,"color") == 0)
@@ -13326,6 +13335,7 @@
}
}
(void) SetImageStorageClass(image,DirectClass);
+ SetPixelComponentMap(image,channel);
q=GetAuthenticPixels(image,region.x,region.y,1,1,exception);
if ((q == (const Quantum *) NULL) || (av == (AV *) NULL) ||
(SvTYPE(av) != SVt_PVAV))
@@ -13342,19 +13352,22 @@
scale=1.0;
if (normalize != MagickFalse)
scale=QuantumRange;
- if (((GetPixelRedTraits(image) & ActivePixelTrait) != 0) && (i <= av_len(av)))
+ if (((GetPixelRedTraits(image) & ActivePixelTrait) != 0) &&
+ (i <= av_len(av)))
{
SetPixelRed(image,ClampToQuantum(scale*SvNV(*(
av_fetch(av,i,0)))),q);
i++;
}
- if (((GetPixelGreenTraits(image) & ActivePixelTrait) != 0) && (i <= av_len(av)))
+ if (((GetPixelGreenTraits(image) & ActivePixelTrait) != 0) &&
+ (i <= av_len(av)))
{
SetPixelGreen(image,ClampToQuantum(scale*SvNV(*(
av_fetch(av,i,0)))),q);
i++;
}
- if (((GetPixelBlueTraits(image) & ActivePixelTrait) != 0) && (i <= av_len(av)))
+ if (((GetPixelBlueTraits(image) & ActivePixelTrait) != 0) &&
+ (i <= av_len(av)))
{
SetPixelBlue(image,ClampToQuantum(scale*SvNV(*(
av_fetch(av,i,0)))),q);
@@ -13367,7 +13380,8 @@
SvNV(*(av_fetch(av,i,0)))),q);
i++;
}
- if (((GetPixelAlphaTraits(image) & ActivePixelTrait) != 0) && (i <= av_len(av)))
+ if (((GetPixelAlphaTraits(image) & ActivePixelTrait) != 0) &&
+ (i <= av_len(av)))
{
SetPixelAlpha(image,ClampToQuantum(scale*
SvNV(*(av_fetch(av,i,0)))),q);
diff --git a/coders/msl.c b/coders/msl.c
index 9804a5a..3a8fe62 100644
--- a/coders/msl.c
+++ b/coders/msl.c
@@ -3226,31 +3226,7 @@
if (*gamma == '\0')
(void) FormatLocaleString(gamma,MaxTextExtent,"%g,%g,%g",
(double) pixel.red,(double) pixel.green,(double) pixel.blue);
- switch (channel)
- {
- default:
- {
- (void) GammaImage(msl_info->image[n],gamma);
- break;
- }
- case RedChannel:
- {
- (void) GammaImageChannel(msl_info->image[n],RedChannel,pixel.red);
- break;
- }
- case GreenChannel:
- {
- (void) GammaImageChannel(msl_info->image[n],GreenChannel,
- pixel.green);
- break;
- }
- case BlueChannel:
- {
- (void) GammaImageChannel(msl_info->image[n],BlueChannel,
- pixel.blue);
- break;
- }
- }
+ (void) GammaImage(msl_info->image[n],atof(gamma));
break;
}
else if (LocaleCompare((const char *) tag,"get") == 0)
@@ -4055,7 +4031,8 @@
}
}
}
- (void) NegateImageChannel(msl_info->image[n],channel,gray);
+ SetPixelComponentMap(msl_info->image[n],channel);
+ (void) NegateImage(msl_info->image[n],gray);
break;
}
if (LocaleCompare((const char *) tag,"normalize") == 0)
@@ -4102,7 +4079,7 @@
}
}
}
- (void) NormalizeImageChannel(msl_info->image[n],channel);
+ (void) NormalizeImage(msl_info->image[n]);
break;
}
ThrowMSLException(OptionError,"UnrecognizedElement",(const char *) tag);