diff --git a/Magick++/demo/demo.cpp b/Magick++/demo/demo.cpp
index 38e8a4d..1535b67 100644
--- a/Magick++/demo/demo.cpp
+++ b/Magick++/demo/demo.cpp
@@ -4,9 +4,6 @@
//
// Simple demo program for Magick++
//
-// Concept and algorithms lifted from PerlMagick demo script written
-// by John Christy.
-//
// Max run-time size 60MB (as compared with 95MB for PerlMagick) under SPARC Solaris
//
@@ -252,12 +249,6 @@
example.level( 0.20*QuantumRange, 0.90*QuantumRange, 1.20 );
images.push_back( example );
- cout << " level red channel ..." << endl;
- example = model;
- example.label( "Level Channel\n(Red Channel)" );
- example.levelChannel( RedChannel, 0.20*QuantumRange, 0.90*QuantumRange, 1.20 );
- images.push_back( example );
-
cout << " median filter ..." << endl;
example = model;
example.label( "Median Filter" );
diff --git a/Magick++/lib/Image.cpp b/Magick++/lib/Image.cpp
index 762a4af..8ff63b8 100644
--- a/Magick++/lib/Image.cpp
+++ b/Magick++/lib/Image.cpp
@@ -1241,31 +1241,7 @@
const double gamma )
{
modifyImage();
- char levels[MaxTextExtent];
- FormatLocaleString( levels, MaxTextExtent, "%g,%g,%g",black_point,white_point,gamma);
- (void) LevelImage( image(), levels );
- throwImageException();
-}
-
-// Level image channel. Adjust the levels of the image channel by
-// scaling the values falling between specified white and black points
-// to the full available quantum range. The parameters provided
-// represent the black, mid (gamma), and white points. The black
-// point specifies the darkest color in the image. Colors darker than
-// the black point are set to zero. Mid point (gamma) specifies a
-// gamma correction to apply to the image. White point specifies the
-// lightest color in the image. Colors brighter than the white point
-// are set to the maximum quantum value. The black and white point
-// have the valid range 0 to QuantumRange while gamma has a useful range of
-// 0 to ten.
-void Magick::Image::levelChannel ( const Magick::ChannelType channel,
- const double black_point,
- const double white_point,
- const double gamma )
-{
- modifyImage();
- (void) LevelImageChannel( image(), channel, black_point, white_point,
- gamma );
+ (void) LevelImage( image(), black_point, white_point, gamma );
throwImageException();
}
diff --git a/Magick++/lib/Magick++/Image.h b/Magick++/lib/Magick++/Image.h
index 57b0983..15f1dae 100644
--- a/Magick++/lib/Magick++/Image.h
+++ b/Magick++/lib/Magick++/Image.h
@@ -418,22 +418,6 @@
const double white_point,
const double mid_point=1.0 );
- // Level image channel. Adjust the levels of the image channel by
- // scaling the values falling between specified white and black
- // points to the full available quantum range. The parameters
- // provided represent the black, mid (gamma), and white points.
- // The black point specifies the darkest color in the
- // image. Colors darker than the black point are set to zero. Mid
- // point (gamma) specifies a gamma correction to apply to the
- // image. White point specifies the lightest color in the image.
- // Colors brighter than the white point are set to the maximum
- // quantum value. The black and white point have the valid range 0
- // to QuantumRange while mid (gamma) has a useful range of 0 to ten.
- void levelChannel ( const ChannelType channel,
- const double black_point,
- const double white_point,
- const double mid_point=1.0 );
-
// Magnify image by integral size
void magnify ( void );
diff --git a/Magick++/lib/Magick++/Include.h b/Magick++/lib/Magick++/Include.h
index 9b01e4f..dbf6275 100644
--- a/Magick++/lib/Magick++/Include.h
+++ b/Magick++/lib/Magick++/Include.h
@@ -767,7 +767,7 @@
using MagickCore::KernelInfo;
using MagickCore::LessValue;
using MagickCore::LevelImage;
- using MagickCore::LevelImageChannel;
+ using MagickCore::LevelImage;
using MagickCore::LocaleCompare;
using MagickCore::LogMagickEvent;
using MagickCore::MagickCoreTerminus;
diff --git a/Magick++/lib/Magick++/STL.h b/Magick++/lib/Magick++/STL.h
index 0483535..4175cd1 100644
--- a/Magick++/lib/Magick++/STL.h
+++ b/Magick++/lib/Magick++/STL.h
@@ -668,24 +668,6 @@
double _mid_point;
};
- // Level image channel
- class MagickDLLDecl levelChannelImage : public std::unary_function<Image&,void>
- {
- public:
- levelChannelImage( const Magick::ChannelType channel,
- const double black_point,
- const double white_point,
- const double mid_point=1.0 );
-
- void operator()( Image &image_ ) const;
-
- private:
- Magick::ChannelType _channel;
- double _black_point;
- double _white_point;
- double _mid_point;
- };
-
// Magnify image by integral size
class MagickDLLDecl magnifyImage : public std::unary_function<Image&,void>
{
diff --git a/Magick++/lib/STL.cpp b/Magick++/lib/STL.cpp
index af681c5..912a9f4 100644
--- a/Magick++/lib/STL.cpp
+++ b/Magick++/lib/STL.cpp
@@ -639,22 +639,6 @@
image_.level( _black_point, _white_point, _mid_point );
}
-// Level image channel
-Magick::levelChannelImage::levelChannelImage( const Magick::ChannelType channel, const double black_point,
- const double white_point,
- const double mid_point )
- : _channel(channel),
- _black_point(black_point),
- _white_point(white_point),
- _mid_point(mid_point)
-{
-}
-
-void Magick::levelChannelImage::operator()( Magick::Image &image_ ) const
-{
- image_.levelChannel( _channel, _black_point, _white_point, _mid_point );
-}
-
// Magnify image by integral size
Magick::magnifyImage::magnifyImage( void )
{
diff --git a/MagickCore/effect.c b/MagickCore/effect.c
index bec60a5..13a2ddf 100644
--- a/MagickCore/effect.c
+++ b/MagickCore/effect.c
@@ -136,6 +136,50 @@
return(blur_image);
}
+MagickExport MagickBooleanType AdaptiveLevelImage(Image *image,
+ const char *levels)
+{
+ double
+ black_point,
+ gamma,
+ 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) QuantumRange;
+ if ((flags & SigmaValue) != 0)
+ white_point=geometry_info.sigma;
+ gamma=1.0;
+ if ((flags & XiValue) != 0)
+ gamma=geometry_info.xi;
+ if ((flags & PercentValue) != 0)
+ {
+ black_point*=(double) image->columns*image->rows/100.0;
+ white_point*=(double) image->columns*image->rows/100.0;
+ }
+ if ((flags & SigmaValue) == 0)
+ white_point=(double) QuantumRange-black_point;
+ if ((flags & AspectValue ) == 0)
+ status=LevelImage(image,black_point,white_point,gamma);
+ else
+ status=LevelizeImage(image,black_point,white_point,gamma);
+ return(status);
+}
+
MagickExport Image *AdaptiveBlurImageChannel(const Image *image,
const ChannelType channel,const double radius,const double sigma,
ExceptionInfo *exception)
@@ -205,14 +249,14 @@
blur_image=DestroyImage(blur_image);
return((Image *) NULL);
}
- (void) LevelImage(edge_image,"20%,95%");
+ (void) AdaptiveLevelImage(edge_image,"20%,95%");
gaussian_image=GaussianBlurImage(edge_image,radius,sigma,exception);
if (gaussian_image != (Image *) NULL)
{
edge_image=DestroyImage(edge_image);
edge_image=gaussian_image;
}
- (void) LevelImage(edge_image,"10%,95%");
+ (void) AdaptiveLevelImage(edge_image,"10%,95%");
/*
Create a set of kernels from maximum (radius,sigma) to minimum.
*/
@@ -515,14 +559,14 @@
sharp_image=DestroyImage(sharp_image);
return((Image *) NULL);
}
- (void) LevelImage(edge_image,"20%,95%");
+ (void) AdaptiveLevelImage(edge_image,"20%,95%");
gaussian_image=GaussianBlurImage(edge_image,radius,sigma,exception);
if (gaussian_image != (Image *) NULL)
{
edge_image=DestroyImage(edge_image);
edge_image=gaussian_image;
}
- (void) LevelImage(edge_image,"10%,95%");
+ (void) AdaptiveLevelImage(edge_image,"10%,95%");
/*
Create a set of kernels from maximum (radius,sigma) to minimum.
*/
diff --git a/MagickCore/enhance.c b/MagickCore/enhance.c
index 86f2a71..9b70abb 100644
--- a/MagickCore/enhance.c
+++ b/MagickCore/enhance.c
@@ -107,6 +107,9 @@
mean,
sans;
+ Image
+ *level_image;
+
log_mean=log(0.5);
if (image->sync != MagickFalse)
{
@@ -116,35 +119,38 @@
(void) GetImageChannelMean(image,DefaultChannels,&mean,&sans,
&image->exception);
gamma=log(mean*QuantumScale)/log_mean;
- return(LevelImageChannel(image,DefaultChannels,0.0,(double) QuantumRange,gamma));
+ return(LevelImage(image,0.0,(double) QuantumRange,gamma));
}
/*
Auto-gamma each channel separately.
*/
status=MagickTrue;
+ level_image=CloneImage(image,0,0,MagickTrue,&image->exception);
+ if (level_image == (Image *) NULL)
+ return(MagickFalse);
if ((GetPixelRedTraits(image) & ActivePixelTrait) != 0)
{
(void) GetImageChannelMean(image,RedChannel,&mean,&sans,
&image->exception);
gamma=log(mean*QuantumScale)/log_mean;
- status=status && LevelImageChannel(image,RedChannel,0.0,(double)
- QuantumRange,gamma);
+ SetPixelComponentMap(level_image,RedChannel);
+ status=status && LevelImage(level_image,0.0,(double) QuantumRange,gamma);
}
if ((GetPixelGreenTraits(image) & ActivePixelTrait) != 0)
{
(void) GetImageChannelMean(image,GreenChannel,&mean,&sans,
&image->exception);
gamma=log(mean*QuantumScale)/log_mean;
- status=status && LevelImageChannel(image,GreenChannel,0.0,(double)
- QuantumRange,gamma);
+ SetPixelComponentMap(level_image,GreenChannel);
+ status=status && LevelImage(level_image,0.0,(double) QuantumRange,gamma);
}
if ((GetPixelBlueTraits(image) & ActivePixelTrait) != 0)
{
(void) GetImageChannelMean(image,BlueChannel,&mean,&sans,
&image->exception);
gamma=log(mean*QuantumScale)/log_mean;
- status=status && LevelImageChannel(image,BlueChannel,0.0,(double)
- QuantumRange,gamma);
+ SetPixelComponentMap(level_image,BlueChannel);
+ status=status && LevelImage(level_image,0.0,(double) QuantumRange,gamma);
}
if (((GetPixelBlackTraits(image) & ActivePixelTrait) != 0) &&
(image->colorspace == CMYKColorspace))
@@ -152,8 +158,8 @@
(void) GetImageChannelMean(image,BlackChannel,&mean,&sans,
&image->exception);
gamma=log(mean*QuantumScale)/log_mean;
- status=status && LevelImageChannel(image,BlackChannel,0.0,(double)
- QuantumRange,gamma);
+ SetPixelComponentMap(level_image,BlackChannel);
+ status=status && LevelImage(level_image,0.0,(double) QuantumRange,gamma);
}
if (((GetPixelAlphaTraits(image) & ActivePixelTrait) != 0) &&
(image->matte == MagickTrue))
@@ -161,9 +167,10 @@
(void) GetImageChannelMean(image,OpacityChannel,&mean,&sans,
&image->exception);
gamma=log(mean*QuantumScale)/log_mean;
- status=status && LevelImageChannel(image,OpacityChannel,0.0,(double)
- QuantumRange,gamma);
+ SetPixelComponentMap(level_image,AlphaChannel);
+ status=status && LevelImage(level_image,0.0,(double) QuantumRange,gamma);
}
+ level_image=DestroyImage(level_image);
return(status != 0 ? MagickTrue : MagickFalse);
}
@@ -676,8 +683,6 @@
% The format of the ClutImage method is:
%
% MagickBooleanType ClutImage(Image *image,Image *clut_image)
-% MagickBooleanType ClutImageChannel(Image *image,
-% const ChannelType channel,Image *clut_image)
%
% A description of each parameter follows:
%
@@ -688,15 +693,8 @@
% o channel: the channel.
%
*/
-
MagickExport MagickBooleanType ClutImage(Image *image,const Image *clut_image)
{
- return(ClutImageChannel(image,DefaultChannels,clut_image));
-}
-
-MagickExport MagickBooleanType ClutImageChannel(Image *image,
- const ChannelType channel,const Image *clut_image)
-{
#define ClampAlphaPixelComponent(pixel) ClampToQuantum((pixel)->alpha)
#define ClampBlackPixelComponent(pixel) ClampToQuantum((pixel)->black)
#define ClampBluePixelComponent(pixel) ClampToQuantum((pixel)->blue)
@@ -822,7 +820,7 @@
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_ClutImageChannel)
+ #pragma omp critical (MagickCore_ClutImage)
#endif
proceed=SetImageProgress(image,ClutImageTag,progress++,image->rows);
if (proceed == MagickFalse)
@@ -2203,8 +2201,6 @@
% The format of the HaldClutImage method is:
%
% MagickBooleanType HaldClutImage(Image *image,Image *hald_image)
-% MagickBooleanType HaldClutImageChannel(Image *image,
-% const ChannelType channel,Image *hald_image)
%
% A description of each parameter follows:
%
@@ -2212,8 +2208,6 @@
%
% o hald_image: the color lookup table image for replacement color values.
%
-% o channel: the channel.
-%
*/
static inline size_t MagickMin(const size_t x,const size_t y)
@@ -2226,12 +2220,6 @@
MagickExport MagickBooleanType HaldClutImage(Image *image,
const Image *hald_image)
{
- return(HaldClutImageChannel(image,DefaultChannels,hald_image));
-}
-
-MagickExport MagickBooleanType HaldClutImageChannel(Image *image,
- const ChannelType channel,const Image *hald_image)
-{
#define HaldClutImageTag "Clut/Image"
typedef struct _HaldInfo
@@ -2384,7 +2372,7 @@
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_HaldClutImageChannel)
+ #pragma omp critical (MagickCore_HaldClutImage)
#endif
proceed=SetImageProgress(image,HaldClutImageTag,progress++,image->rows);
if (proceed == MagickFalse)
@@ -2436,96 +2424,8 @@
% A '!' flag inverts the re-mapping.
%
*/
-
-MagickExport MagickBooleanType LevelImage(Image *image,const char *levels)
-{
- double
- black_point,
- gamma,
- 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) QuantumRange;
- if ((flags & SigmaValue) != 0)
- white_point=geometry_info.sigma;
- gamma=1.0;
- if ((flags & XiValue) != 0)
- gamma=geometry_info.xi;
- if ((flags & PercentValue) != 0)
- {
- black_point*=(double) image->columns*image->rows/100.0;
- white_point*=(double) image->columns*image->rows/100.0;
- }
- if ((flags & SigmaValue) == 0)
- white_point=(double) QuantumRange-black_point;
- if ((flags & AspectValue ) == 0)
- status=LevelImageChannel(image,DefaultChannels,black_point,white_point,
- gamma);
- else
- status=LevelizeImage(image,black_point,white_point,gamma);
- return(status);
-}
-
-/*
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% %
-% %
-% %
-% L e v e l i z e I m a g e %
-% %
-% %
-% %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% LevelizeImage() applies the normal level operation to the image, spreading
-% out the values between the black and white points over the entire range of
-% values. Gamma correction is also applied after the values has been mapped.
-%
-% It is typically used to improve image contrast, or to provide a controlled
-% linear threshold for the image. If the black and white points are set to
-% the minimum and maximum values found in the image, the image can be
-% normalized. or by swapping black and white values, negate the image.
-%
-% The format of the LevelizeImage method is:
-%
-% MagickBooleanType LevelizeImage(Image *image,const double black_point,
-% const double white_point,const double gamma)
-% MagickBooleanType LevelizeImageChannel(Image *image,
-% const ChannelType channel,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 which is to be mapped to zero (black)
-%
-% o white_point: The level which is to be mapped to QuantiumRange (white)
-%
-% o gamma: adjust gamma by this factor before mapping values.
-% use 1.0 for purely linear stretching of image color values
-%
-*/
-MagickExport MagickBooleanType LevelImageChannel(Image *image,
- const ChannelType channel,const double black_point,const double white_point,
- const double gamma)
+MagickExport MagickBooleanType LevelImage(Image *image,
+ const double black_point,const double white_point,const double gamma)
{
#define LevelImageTag "Level/Image"
#define LevelQuantum(x) (ClampToQuantum((MagickRealType) QuantumRange* \
@@ -2633,7 +2533,7 @@
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_LevelImageChannel)
+ #pragma omp critical (MagickCore_LevelImage)
#endif
proceed=SetImageProgress(image,LevelImageTag,progress++,image->rows);
if (proceed == MagickFalse)
@@ -2886,43 +2786,69 @@
if (invert == MagickFalse)
{
if ((GetPixelRedTraits(image) & ActivePixelTrait) != 0)
- status|=LevelImageChannel(image,RedChannel,
- black_color->red,white_color->red,(double) 1.0);
+ {
+ SetPixelComponentMap(image,RedChannel);
+ status|=LevelImage(image,black_color->red,white_color->red,1.0);
+ }
if ((GetPixelGreenTraits(image) & ActivePixelTrait) != 0)
- status|=LevelImageChannel(image,GreenChannel,
- black_color->green,white_color->green,(double) 1.0);
+ {
+ SetPixelComponentMap(image,GreenChannel);
+ status|=LevelImage(image,black_color->green,white_color->green,1.0);
+ }
if ((GetPixelBlueTraits(image) & ActivePixelTrait) != 0)
- status|=LevelImageChannel(image,BlueChannel,
- black_color->blue,white_color->blue,(double) 1.0);
+ {
+ SetPixelComponentMap(image,BlueChannel);
+ status|=LevelImage(image,black_color->blue,white_color->blue,1.0);
+ }
if (((GetPixelBlackTraits(image) & ActivePixelTrait) != 0) &&
(image->colorspace == CMYKColorspace))
- status|=LevelImageChannel(image,BlackChannel,
- black_color->black,white_color->black,(double) 1.0);
+ {
+ SetPixelComponentMap(image,BlackChannel);
+ status|=LevelImage(image,black_color->black,white_color->black,1.0);
+ }
if (((GetPixelAlphaTraits(image) & ActivePixelTrait) != 0) &&
(image->matte == MagickTrue))
- status|=LevelImageChannel(image,OpacityChannel,
- black_color->alpha,white_color->alpha,(double) 1.0);
+ {
+ SetPixelComponentMap(image,AlphaChannel);
+ status|=LevelImage(image,black_color->alpha,white_color->alpha,1.0);
+ }
}
else
{
if ((GetPixelRedTraits(image) & ActivePixelTrait) != 0)
- status|=LevelizeImageChannel(image,RedChannel,
- black_color->red,white_color->red,(double) 1.0);
+ {
+ SetPixelComponentMap(image,RedChannel);
+ status|=LevelizeImageChannel(image,RedChannel,
+ black_color->red,white_color->red,(double) 1.0);
+ }
if ((GetPixelGreenTraits(image) & ActivePixelTrait) != 0)
- status|=LevelizeImageChannel(image,GreenChannel,
- black_color->green,white_color->green,(double) 1.0);
+ {
+ SetPixelComponentMap(image,GreenChannel);
+ status|=LevelizeImageChannel(image,GreenChannel,
+ black_color->green,white_color->green,(double) 1.0);
+ }
if ((GetPixelBlueTraits(image) & ActivePixelTrait) != 0)
- status|=LevelizeImageChannel(image,BlueChannel,
- black_color->blue,white_color->blue,(double) 1.0);
+ {
+ SetPixelComponentMap(image,BlueChannel);
+ status|=LevelizeImageChannel(image,BlueChannel,
+ black_color->blue,white_color->blue,(double) 1.0);
+ }
if (((GetPixelBlackTraits(image) & ActivePixelTrait) != 0) &&
(image->colorspace == CMYKColorspace))
- status|=LevelizeImageChannel(image,BlackChannel,
- black_color->black,white_color->black,(double) 1.0);
+ {
+ SetPixelComponentMap(image,BlackChannel);
+ status|=LevelizeImageChannel(image,BlackChannel,
+ black_color->black,white_color->black,(double) 1.0);
+ }
if (((GetPixelAlphaTraits(image) & ActivePixelTrait) != 0) &&
(image->matte == MagickTrue))
- status|=LevelizeImageChannel(image,OpacityChannel,
- black_color->alpha,white_color->alpha,(double) 1.0);
+ {
+ SetPixelComponentMap(image,AlphaChannel);
+ status|=LevelizeImageChannel(image,OpacityChannel,
+ black_color->alpha,white_color->alpha,(double) 1.0);
+ }
}
+ SetPixelComponentMap(image,DefaultChannels);
return(status == 0 ? MagickFalse : MagickTrue);
}
@@ -3024,8 +2950,7 @@
break;
}
histogram=(MagickRealType *) RelinquishMagickMemory(histogram);
- status=LevelImageChannel(image,DefaultChannels,(double) black,(double) white,
- 1.0);
+ status=LevelImage(image,(double) black,(double) white,1.0);
return(status);
}
diff --git a/MagickCore/enhance.h b/MagickCore/enhance.h
index 95d00c8..31f25c0 100644
--- a/MagickCore/enhance.h
+++ b/MagickCore/enhance.h
@@ -27,7 +27,6 @@
AutoLevelImage(Image *),
BrightnessContrastImage(Image *,const double,const double),
ClutImage(Image *,const Image *),
- ClutImageChannel(Image *,const ChannelType,const Image *),
ColorDecisionListImage(Image *,const char *),
ContrastImage(Image *,const MagickBooleanType),
ContrastStretchImage(Image *,const char *),
@@ -38,10 +37,7 @@
GammaImage(Image *,const char *),
GammaImageChannel(Image *,const ChannelType,const double),
HaldClutImage(Image *,const Image *),
- HaldClutImageChannel(Image *,const ChannelType,const Image *),
- LevelImage(Image *,const char *),
- LevelImageChannel(Image *,const ChannelType,const double,const double,
- const double),
+ 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),
diff --git a/MagickCore/histogram.c b/MagickCore/histogram.c
index 6c3d8c4..f2877b8 100644
--- a/MagickCore/histogram.c
+++ b/MagickCore/histogram.c
@@ -979,7 +979,6 @@
% from the minimum and maximum points by this color value.
%
*/
-
MagickExport MagickBooleanType MinMaxStretchImage(Image *image,
const ChannelType channel,const double black_value,const double white_value)
{
@@ -987,6 +986,9 @@
min,
max;
+ Image
+ *stretch_image;
+
MagickStatusType
status;
@@ -1000,19 +1002,25 @@
min+=black_value;
max-=white_value;
if (fabs(min-max) >= MagickEpsilon)
- status&=LevelImageChannel(image,channel,min,max,1.0);
+ status&=LevelImage(image,min,max,1.0);
return(status != 0 ? MagickTrue : MagickFalse);
}
/*
Auto-level each channel separately.
*/
+ stretch_image=CloneImage(image,0,0,MagickTrue,&image->exception);
+ if (stretch_image == (Image *) NULL)
+ return(MagickFalse);
if ((GetPixelRedTraits(image) & ActivePixelTrait) != 0)
{
(void) GetImageChannelRange(image,RedChannel,&min,&max,&image->exception);
min+=black_value;
max-=white_value;
if (fabs(min-max) >= MagickEpsilon)
- status&=LevelImageChannel(image,RedChannel,min,max,1.0);
+ {
+ SetPixelComponentMap(stretch_image,RedChannel);
+ status&=LevelImage(stretch_image,min,max,1.0);
+ }
}
if ((GetPixelGreenTraits(image) & ActivePixelTrait) != 0)
{
@@ -1021,7 +1029,10 @@
min+=black_value;
max-=white_value;
if (fabs(min-max) >= MagickEpsilon)
- status&=LevelImageChannel(image,GreenChannel,min,max,1.0);
+ {
+ SetPixelComponentMap(stretch_image,GreenChannel);
+ status&=LevelImage(stretch_image,min,max,1.0);
+ }
}
if ((GetPixelBlueTraits(image) & ActivePixelTrait) != 0)
{
@@ -1030,7 +1041,10 @@
min+=black_value;
max-=white_value;
if (fabs(min-max) >= MagickEpsilon)
- status&=LevelImageChannel(image,BlueChannel,min,max,1.0);
+ {
+ SetPixelComponentMap(stretch_image,BlueChannel);
+ status&=LevelImage(stretch_image,min,max,1.0);
+ }
}
if (((GetPixelBlackTraits(image) & ActivePixelTrait) != 0) &&
(image->colorspace == CMYKColorspace))
@@ -1040,7 +1054,10 @@
min+=black_value;
max-=white_value;
if (fabs(min-max) >= MagickEpsilon)
- status&=LevelImageChannel(image,BlackChannel,min,max,1.0);
+ {
+ SetPixelComponentMap(stretch_image,BlackChannel);
+ status&=LevelImage(stretch_image,min,max,1.0);
+ }
}
if (((GetPixelAlphaTraits(image) & ActivePixelTrait) != 0) &&
(image->matte == MagickTrue))
@@ -1050,8 +1067,12 @@
min+=black_value;
max-=white_value;
if (fabs(min-max) >= MagickEpsilon)
- status&=LevelImageChannel(image,OpacityChannel,min,max,1.0);
+ {
+ SetPixelComponentMap(stretch_image,AlphaChannel);
+ status&=LevelImage(stretch_image,min,max,1.0);
+ }
}
+ stretch_image=DestroyImage(stretch_image);
return(status != 0 ? MagickTrue : MagickFalse);
}
diff --git a/MagickCore/magick-config.h b/MagickCore/magick-config.h
index 2f9648e..9002a55 100644
--- a/MagickCore/magick-config.h
+++ b/MagickCore/magick-config.h
@@ -12,7 +12,9 @@
/* #undef AUTOTRACE_DELEGATE */
/* Define if coders and filters are to be built as modules. */
-/* #undef BUILD_MODULES */
+#ifndef MAGICKCORE_BUILD_MODULES
+#define MAGICKCORE_BUILD_MODULES 1
+#endif
/* Define if you have the bzip2 library */
#ifndef MAGICKCORE_BZLIB_DELEGATE
@@ -54,7 +56,9 @@
#endif
/* Define if you have DJVU library */
-/* #undef DJVU_DELEGATE */
+#ifndef MAGICKCORE_DJVU_DELEGATE
+#define MAGICKCORE_DJVU_DELEGATE 1
+#endif
/* Directory where ImageMagick documents live. */
#ifndef MAGICKCORE_DOCUMENTATION_PATH
@@ -76,7 +80,9 @@
#endif
/* Define if you have FFTW library */
-/* #undef FFTW_DELEGATE */
+#ifndef MAGICKCORE_FFTW_DELEGATE
+#define MAGICKCORE_FFTW_DELEGATE 1
+#endif
/* Location of filter modules */
#ifndef MAGICKCORE_FILTER_PATH
@@ -415,15 +421,15 @@
#endif
/* Define if you have the <lcms2.h> header file. */
-#ifndef MAGICKCORE_HAVE_LCMS2_H
-#define MAGICKCORE_HAVE_LCMS2_H 1
-#endif
+/* #undef HAVE_LCMS2_H */
/* Define if you have the <lcms2/lcms2.h> header file. */
/* #undef HAVE_LCMS2_LCMS2_H */
/* Define if you have the <lcms.h> header file. */
-/* #undef HAVE_LCMS_H */
+#ifndef MAGICKCORE_HAVE_LCMS_H
+#define MAGICKCORE_HAVE_LCMS_H 1
+#endif
/* Define if you have the <lcms/lcms.h> header file. */
/* #undef HAVE_LCMS_LCMS_H */
@@ -1146,7 +1152,9 @@
#endif
/* Define if you have JBIG library */
-/* #undef JBIG_DELEGATE */
+#ifndef MAGICKCORE_JBIG_DELEGATE
+#define MAGICKCORE_JBIG_DELEGATE 1
+#endif
/* Define if you have JPEG version 2 "Jasper" library */
#ifndef MAGICKCORE_JP2_DELEGATE
@@ -1175,7 +1183,9 @@
#endif
/* Define if you have LQR library */
-/* #undef LQR_DELEGATE */
+#ifndef MAGICKCORE_LQR_DELEGATE
+#define MAGICKCORE_LQR_DELEGATE 1
+#endif
/* Define if using libltdl to support dynamically loadable modules */
#ifndef MAGICKCORE_LTDL_DELEGATE
@@ -1187,7 +1197,7 @@
/* Define to the system default library search path. */
#ifndef MAGICKCORE_LT_DLSEARCH_PATH
-#define MAGICKCORE_LT_DLSEARCH_PATH "/lib64:/usr/lib64:/lib:/usr/lib:/usr/lib64/atlas:/usr/lib64/mysql:/usr/lib64/qt-3.3/lib:/usr/lib64/tcl8.5/tclx8.4:/usr/lib64/tcl8.5:/usr/lib/wine/:/usr/lib64/wine/:/usr/lib64/xulrunner-2"
+#define MAGICKCORE_LT_DLSEARCH_PATH "/lib64:/usr/lib64:/lib:/usr/lib:/usr/lib64/R/lib:/usr/lib64/atlas:/opt/modules/pkg/intel/f77/10.0.025/lib:/usr/local/lib:/usr/lib64/mysql:/usr/lib64/qt-3.3/lib:/usr/lib64/xulrunner-2"
#endif
/* The archive extension */
@@ -1238,7 +1248,9 @@
/* #undef NO_MINUS_C_MINUS_O */
/* Define if you have OPENEXR library */
-/* #undef OPENEXR_DELEGATE */
+#ifndef MAGICKCORE_OPENEXR_DELEGATE
+#define MAGICKCORE_OPENEXR_DELEGATE 1
+#endif
/* Define to the address where bug reports for this package should be sent. */
#ifndef MAGICKCORE_PACKAGE_BUGREPORT
@@ -1293,7 +1305,9 @@
#endif
/* Define if you have RSVG library */
-/* #undef RSVG_DELEGATE */
+#ifndef MAGICKCORE_RSVG_DELEGATE
+#define MAGICKCORE_RSVG_DELEGATE 1
+#endif
/* Define to the type of arg 1 for `select'. */
#ifndef MAGICKCORE_SELECT_TYPE_ARG1
@@ -1430,7 +1444,9 @@
/* Define if you have WEBP library */
-/* #undef WEBP_DELEGATE */
+#ifndef MAGICKCORE_WEBP_DELEGATE
+#define MAGICKCORE_WEBP_DELEGATE 1
+#endif
/* Define to use the Windows GDI32 library */
/* #undef WINGDI32_DELEGATE */
@@ -1439,7 +1455,9 @@
/* #undef WITH_DMALLOC */
/* Define if you have WMF library */
-/* #undef WMF_DELEGATE */
+#ifndef MAGICKCORE_WMF_DELEGATE
+#define MAGICKCORE_WMF_DELEGATE 1
+#endif
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
diff --git a/MagickCore/methods.h b/MagickCore/methods.h
index d031839..abc5a51 100644
--- a/MagickCore/methods.h
+++ b/MagickCore/methods.h
@@ -170,7 +170,7 @@
#define CloseBlob PrependMagickMethod(CloseBlob)
#define CloseCacheView PrependMagickMethod(CloseCacheView)
#define CloseMagickLog PrependMagickMethod(CloseMagickLog)
-#define ClutImageChannel PrependMagickMethod(ClutImageChannel)
+#define ClutImage PrependMagickMethod(ClutImage)
#define ClutImage PrependMagickMethod(ClutImage)
#define CoalesceImages PrependMagickMethod(CoalesceImages)
#define CoderComponentGenesis PrependMagickMethod(CoderComponentGenesis)
@@ -616,7 +616,7 @@
#define GlobExpression PrependMagickMethod(GlobExpression)
#define GradientImage PrependMagickMethod(GradientImage)
#define GravityAdjustGeometry PrependMagickMethod(GravityAdjustGeometry)
-#define HaldClutImageChannel PrependMagickMethod(HaldClutImageChannel)
+#define HaldClutImage PrependMagickMethod(HaldClutImage)
#define HaldClutImage PrependMagickMethod(HaldClutImage)
#define HashPointerType PrependMagickMethod(HashPointerType)
#define HashStringInfoType PrependMagickMethod(HashStringInfoType)
@@ -684,7 +684,7 @@
#define LeastSquaresAddTerms PrependMagickMethod(LeastSquaresAddTerms)
#define LevelColorsImageChannel PrependMagickMethod(LevelColorsImageChannel)
#define LevelColorsImage PrependMagickMethod(LevelColorsImage)
-#define LevelImageChannel PrependMagickMethod(LevelImageChannel)
+#define LevelImage PrependMagickMethod(LevelImage)
#define LevelImageColors PrependMagickMethod(LevelImageColors)
#define LevelImage PrependMagickMethod(LevelImage)
#define LevelizeImageChannel PrependMagickMethod(LevelizeImageChannel)
diff --git a/MagickCore/threshold.c b/MagickCore/threshold.c
index 5cab30b..b5c7b05 100644
--- a/MagickCore/threshold.c
+++ b/MagickCore/threshold.c
@@ -335,7 +335,7 @@
%
% o threshold: define the threshold values.
%
-% Aside: You can get the same results as operator using LevelImageChannels()
+% Aside: You can get the same results as operator using LevelImages()
% with the 'threshold' value for both the black_point and the white_point.
%
*/
diff --git a/MagickCore/version.h b/MagickCore/version.h
index c704891..fdb711e 100644
--- a/MagickCore/version.h
+++ b/MagickCore/version.h
@@ -27,7 +27,7 @@
*/
#define MagickPackageName "ImageMagick"
#define MagickCopyright "Copyright (C) 1999-2011 ImageMagick Studio LLC"
-#define MagickSVNRevision "4693"
+#define MagickSVNRevision "exported"
#define MagickLibVersion 0x700
#define MagickLibVersionText "7.0.0"
#define MagickLibVersionNumber 5,0,0
diff --git a/MagickWand/magick-image.c b/MagickWand/magick-image.c
index 587a9eb..bbbb390 100644
--- a/MagickWand/magick-image.c
+++ b/MagickWand/magick-image.c
@@ -1363,8 +1363,6 @@
%
% MagickBooleanType MagickClutImage(MagickWand *wand,
% const MagickWand *clut_wand)
-% MagickBooleanType MagickClutImageChannel(MagickWand *wand,
-% const ChannelType channel,const MagickWand *clut_wand)
%
% A description of each parameter follows:
%
@@ -1373,30 +1371,19 @@
% o clut_image: the clut image.
%
*/
-
WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
const MagickWand *clut_wand)
{
MagickBooleanType
status;
- status=MagickClutImageChannel(wand,DefaultChannels,clut_wand);
- return(status);
-}
-
-WandExport MagickBooleanType MagickClutImageChannel(MagickWand *wand,
- const ChannelType channel,const MagickWand *clut_wand)
-{
- 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) || (clut_wand->images == (Image *) NULL))
ThrowWandException(WandError,"ContainsNoImages",wand->name);
- status=ClutImageChannel(wand->images,channel,clut_wand->images);
+ status=ClutImage(wand->images,clut_wand->images);
if (status == MagickFalse)
InheritException(wand->exception,&wand->images->exception);
return(status);
@@ -5997,8 +5984,6 @@
%
% MagickBooleanType MagickHaldClutImage(MagickWand *wand,
% const MagickWand *hald_wand)
-% MagickBooleanType MagickHaldClutImageChannel(MagickWand *wand,
-% const ChannelType channel,const MagickWand *hald_wand)
%
% A description of each parameter follows:
%
@@ -6007,30 +5992,19 @@
% o hald_image: the hald CLUT image.
%
*/
-
WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
const MagickWand *hald_wand)
{
MagickBooleanType
status;
- status=MagickHaldClutImageChannel(wand,DefaultChannels,hald_wand);
- return(status);
-}
-
-WandExport MagickBooleanType MagickHaldClutImageChannel(MagickWand *wand,
- const ChannelType channel,const MagickWand *hald_wand)
-{
- 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) || (hald_wand->images == (Image *) NULL))
ThrowWandException(WandError,"ContainsNoImages",wand->name);
- status=HaldClutImageChannel(wand->images,channel,hald_wand->images);
+ status=HaldClutImage(wand->images,hald_wand->images);
if (status == MagickFalse)
InheritException(wand->exception,&wand->images->exception);
return(status);
@@ -6415,7 +6389,7 @@
%
% MagickBooleanType MagickLevelImage(MagickWand *wand,
% const double black_point,const double gamma,const double white_point)
-% MagickBooleanType MagickLevelImageChannel(MagickWand *wand,
+% MagickBooleanType MagickLevelImage(MagickWand *wand,
% const ChannelType channel,const double black_point,const double gamma,
% const double white_point)
%
@@ -6432,32 +6406,19 @@
% o white_point: the white point.
%
*/
-
WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
const double black_point,const double gamma,const double white_point)
{
MagickBooleanType
status;
- status=MagickLevelImageChannel(wand,DefaultChannels,black_point,gamma,
- white_point);
- return(status);
-}
-
-WandExport MagickBooleanType MagickLevelImageChannel(MagickWand *wand,
- const ChannelType channel,const double black_point,const double gamma,
- 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=LevelImageChannel(wand->images,channel,black_point,white_point,gamma);
+ status=LevelImage(wand->images,black_point,white_point,gamma);
if (status == MagickFalse)
InheritException(wand->exception,&wand->images->exception);
return(status);
diff --git a/MagickWand/magick-image.h b/MagickWand/magick-image.h
index 814bce5..c95b6a0 100644
--- a/MagickWand/magick-image.h
+++ b/MagickWand/magick-image.h
@@ -104,7 +104,6 @@
MagickClipImage(MagickWand *),
MagickClipImagePath(MagickWand *,const char *,const MagickBooleanType),
MagickClutImage(MagickWand *,const MagickWand *),
- MagickClutImageChannel(MagickWand *,const ChannelType,const MagickWand *),
MagickColorDecisionListImage(MagickWand *,const char *),
MagickColorizeImage(MagickWand *,const PixelWand *,const PixelWand *),
MagickColorMatrixImage(MagickWand *,const KernelInfo *),
@@ -187,7 +186,6 @@
MagickGetImageResolution(MagickWand *,double *,double *),
MagickGetImageWhitePoint(MagickWand *,double *,double *),
MagickHaldClutImage(MagickWand *,const MagickWand *),
- MagickHaldClutImageChannel(MagickWand *,const ChannelType,const MagickWand *),
MagickHasNextImage(MagickWand *),
MagickHasPreviousImage(MagickWand *),
MagickImplodeImage(MagickWand *,const double),
@@ -197,8 +195,6 @@
const MagickBooleanType),
MagickLabelImage(MagickWand *,const char *),
MagickLevelImage(MagickWand *,const double,const double,const double),
- MagickLevelImageChannel(MagickWand *,const ChannelType,const double,
- const double,const double),
MagickLinearStretchImage(MagickWand *,const double,const double),
MagickLiquidRescaleImage(MagickWand *,const size_t,const size_t,const double,
const double),
diff --git a/MagickWand/mogrify.c b/MagickWand/mogrify.c
index e9853ac..5065193 100644
--- a/MagickWand/mogrify.c
+++ b/MagickWand/mogrify.c
@@ -1892,8 +1892,7 @@
(void) LevelizeImageChannel(*image,channel,black_point,
white_point,gamma);
else
- (void) LevelImageChannel(*image,channel,black_point,white_point,
- gamma);
+ (void) LevelImage(*image,black_point,white_point,gamma);
InheritException(exception,&(*image)->exception);
break;
}
@@ -7372,7 +7371,7 @@
status=MagickFalse;
break;
}
- (void) ClutImageChannel(image,channel,clut_image);
+ (void) ClutImage(image,clut_image);
clut_image=DestroyImage(clut_image);
InheritException(exception,&image->exception);
*images=DestroyImageList(*images);
@@ -7653,7 +7652,7 @@
status=MagickFalse;
break;
}
- (void) HaldClutImageChannel(image,channel,hald_image);
+ (void) HaldClutImage(image,hald_image);
hald_image=DestroyImage(hald_image);
InheritException(exception,&image->exception);
if (*images != (Image *) NULL)
diff --git a/PerlMagick/Magick.xs b/PerlMagick/Magick.xs
index 0b7cf72..77046e1 100644
--- a/PerlMagick/Magick.xs
+++ b/PerlMagick/Magick.xs
@@ -9308,13 +9308,16 @@
if (attribute_flag[3] != 0)
gamma=argument_list[3].real_reference;
if (attribute_flag[4] != 0)
- channel=(ChannelType) argument_list[4].integer_reference;
+ {
+ channel=(ChannelType) argument_list[4].integer_reference;
+ SetPixelComponentMap(image,channel);
+ }
if (attribute_flag[5] != 0)
{
argument_list[0].real_reference=argument_list[5].real_reference;
attribute_flag[0]=attribute_flag[5];
}
- (void) LevelImageChannel(image,channel,black_point,white_point,gamma);
+ (void) LevelImage(image,black_point,white_point,gamma);
break;
}
case 74: /* Clip */
@@ -10151,7 +10154,7 @@
}
if (attribute_flag[1] != 0)
channel=(ChannelType) argument_list[1].integer_reference;
- (void) ClutImageChannel(image,channel,
+ (void) ClutImage(image,channel,
argument_list[0].image_reference);
break;
}
@@ -10344,9 +10347,11 @@
goto PerlException;
}
if (attribute_flag[1] != 0)
- channel=(ChannelType) argument_list[1].integer_reference;
- (void) HaldClutImageChannel(image,channel,
- argument_list[0].image_reference);
+ {
+ channel=(ChannelType) argument_list[1].integer_reference;
+ SetPixelComponentMap(image,channel);
+ }
+ (void) HaldClutImage(image,argument_list[0].image_reference);
break;
}
case 123: /* BlueShift */
diff --git a/coders/msl.c b/coders/msl.c
index 46d8c6b..9804a5a 100644
--- a/coders/msl.c
+++ b/coders/msl.c
@@ -3509,13 +3509,8 @@
}
/* process image */
- {
- char level[MaxTextExtent + 1];
- (void) FormatLocaleString(level,MaxTextExtent,"%3.6f/%3.6f/%3.6f/",
- levelBlack,levelGamma,levelWhite);
- LevelImage ( msl_info->image[n], level );
- break;
- }
+ LevelImage(msl_info->image[n],levelBlack,levelWhite,levelGamma);
+ break;
}
}
case 'M':