% MagickCore Image Enhancement Methods %
% %
% Software Design %
-% John Cristy %
+% Cristy %
% July 1992 %
% %
% %
-% Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2014 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
if( IfMagickFalse(status) )
break;
}
- return(status);
+ return(status != 0 ? MagickTrue : MagickFalse);
}
\f
/*
green,
red;
+ red=0.0;
+ green=0.0;
+ blue=0.0;
Contrast(sign,&red,&green,&blue);
image->colormap[i].red=(MagickRealType) red;
- image->colormap[i].red=(MagickRealType) red;
- image->colormap[i].red=(MagickRealType) red;
+ image->colormap[i].green=(MagickRealType) green;
+ image->colormap[i].blue=(MagickRealType) blue;
}
}
/*
if (GetPixelReadMask(image,p) == 0)
{
+ SetPixelBackgoundColor(enhance_image,q);
p+=GetPixelChannels(image);
q+=GetPixelChannels(enhance_image);
continue;
progress;
double
- black[CompositePixelChannel],
+ black[CompositePixelChannel+1],
*equalize_map,
*histogram,
*map,
- white[CompositePixelChannel];
+ white[CompositePixelChannel+1];
register ssize_t
i;
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
equalize_map=(double *) AcquireQuantumMemory(MaxMap+1UL,
GetPixelChannels(image)*sizeof(*equalize_map));
- histogram=(double *) AcquireQuantumMemory(MaxMap+1UL,
- GetPixelChannels(image)*sizeof(*histogram));
- map=(double *) AcquireQuantumMemory(MaxMap+1UL,
- GetPixelChannels(image)*sizeof(*map));
+ histogram=(double *) AcquireQuantumMemory(MaxMap+1UL,GetPixelChannels(image)*
+ sizeof(*histogram));
+ map=(double *) AcquireQuantumMemory(MaxMap+1UL,GetPixelChannels(image)*
+ sizeof(*map));
if ((equalize_map == (double *) NULL) || (histogram == (double *) NULL) ||
(map == (double *) NULL))
{
}
(void) ResetMagickMemory(equalize_map,0,(MaxMap+1)*GetPixelChannels(image)*
sizeof(*equalize_map));
+ (void) ResetMagickMemory(black,0,sizeof(*black));
+ (void) ResetMagickMemory(white,0,sizeof(*white));
number_channels=GetPixelChannels(image);
for (i=0; i < (ssize_t) number_channels; i++)
{
if( IfMagickFalse(SetImageStorageClass(image,DirectClass,exception)) )
return(MagickFalse);
}
- switch (image->intensity)
- {
- case Rec601LuminancePixelIntensityMethod:
- case Rec709LuminancePixelIntensityMethod:
- {
- (void) SetImageColorspace(image,RGBColorspace,exception);
- break;
- }
- case Rec601LumaPixelIntensityMethod:
- case Rec709LumaPixelIntensityMethod:
- case UndefinedPixelIntensityMethod:
- {
- (void) SetImageColorspace(image,sRGBColorspace,exception);
- break;
- }
- default:
- break;
- }
/*
Grayscale image.
*/
green=EncodePixelGamma(green);
blue=EncodePixelGamma(blue);
}
- intensity=0.21258623078559555160*red+0.71517030370341084990*
- green+0.07220049864333622685*blue;
+ intensity=0.212656*red+0.715158*green+0.072186*blue;
break;
}
case Rec709LuminancePixelIntensityMethod:
green=DecodePixelGamma(green);
blue=DecodePixelGamma(blue);
}
- intensity=0.21258623078559555160*red+0.71517030370341084990*
- green+0.07220049864333622685*blue;
+ intensity=0.212656*red+0.715158*green+0.072186*blue;
break;
}
case RMSPixelIntensityMethod:
}
}
image_view=DestroyCacheView(image_view);
+ (void) ClampImage(image,exception);
return(status);
}
\f
if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
{
channel_mask=SetImageChannelMask(image,RedChannel);
- status|=LevelImage(image,black_color->red,white_color->red,1.0,
+ status&=LevelImage(image,black_color->red,white_color->red,1.0,
exception);
(void) SetImageChannelMask(image,channel_mask);
}
if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
{
channel_mask=SetImageChannelMask(image,GreenChannel);
- status|=LevelImage(image,black_color->green,white_color->green,1.0,
+ status&=LevelImage(image,black_color->green,white_color->green,1.0,
exception);
(void) SetImageChannelMask(image,channel_mask);
}
if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
{
channel_mask=SetImageChannelMask(image,BlueChannel);
- status|=LevelImage(image,black_color->blue,white_color->blue,1.0,
+ status&=LevelImage(image,black_color->blue,white_color->blue,1.0,
exception);
(void) SetImageChannelMask(image,channel_mask);
}
(image->colorspace == CMYKColorspace))
{
channel_mask=SetImageChannelMask(image,BlackChannel);
- status|=LevelImage(image,black_color->black,white_color->black,1.0,
+ status&=LevelImage(image,black_color->black,white_color->black,1.0,
exception);
(void) SetImageChannelMask(image,channel_mask);
}
(image->alpha_trait == BlendPixelTrait))
{
channel_mask=SetImageChannelMask(image,AlphaChannel);
- status|=LevelImage(image,black_color->alpha,white_color->alpha,1.0,
+ status&=LevelImage(image,black_color->alpha,white_color->alpha,1.0,
exception);
(void) SetImageChannelMask(image,channel_mask);
}
if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
{
channel_mask=SetImageChannelMask(image,RedChannel);
- status|=LevelizeImage(image,black_color->red,white_color->red,1.0,
+ status&=LevelizeImage(image,black_color->red,white_color->red,1.0,
exception);
(void) SetImageChannelMask(image,channel_mask);
}
if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
{
channel_mask=SetImageChannelMask(image,GreenChannel);
- status|=LevelizeImage(image,black_color->green,white_color->green,1.0,
+ status&=LevelizeImage(image,black_color->green,white_color->green,1.0,
exception);
(void) SetImageChannelMask(image,channel_mask);
}
if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
{
channel_mask=SetImageChannelMask(image,BlueChannel);
- status|=LevelizeImage(image,black_color->blue,white_color->blue,1.0,
+ status&=LevelizeImage(image,black_color->blue,white_color->blue,1.0,
exception);
(void) SetImageChannelMask(image,channel_mask);
}
(image->colorspace == CMYKColorspace))
{
channel_mask=SetImageChannelMask(image,BlackChannel);
- status|=LevelizeImage(image,black_color->black,white_color->black,1.0,
+ status&=LevelizeImage(image,black_color->black,white_color->black,1.0,
exception);
(void) SetImageChannelMask(image,channel_mask);
}
(image->alpha_trait == BlendPixelTrait))
{
channel_mask=SetImageChannelMask(image,AlphaChannel);
- status|=LevelizeImage(image,black_color->alpha,white_color->alpha,1.0,
+ status&=LevelizeImage(image,black_color->alpha,white_color->alpha,1.0,
exception);
(void) SetImageChannelMask(image,channel_mask);
}
}
- return(status);
+ return(status != 0 ? MagickTrue : MagickFalse);
}
\f
/*
red=(double) image->colormap[i].red;
green=(double) image->colormap[i].green;
blue=(double) image->colormap[i].blue;
- if( IfMagickTrue(IssRGBColorspace(image->colorspace)) )
- {
- red=DecodePixelGamma((MagickRealType) red);
- green=DecodePixelGamma((MagickRealType) green);
- blue=DecodePixelGamma((MagickRealType) blue);
- }
switch (colorspace)
{
case HCLColorspace:
break;
}
}
- if( IfMagickTrue(IssRGBColorspace(image->colorspace)) )
- {
- red=EncodePixelGamma(red);
- green=EncodePixelGamma(green);
- blue=EncodePixelGamma(blue);
- }
image->colormap[i].red=red;
image->colormap[i].green=green;
image->colormap[i].blue=blue;
red=(double) GetPixelRed(image,q);
green=(double) GetPixelGreen(image,q);
blue=(double) GetPixelBlue(image,q);
- if( IfMagickTrue(IssRGBColorspace(image->colorspace)) )
- {
- red=DecodePixelGamma((MagickRealType) red);
- green=DecodePixelGamma((MagickRealType) green);
- blue=DecodePixelGamma((MagickRealType) blue);
- }
switch (colorspace)
{
case HCLColorspace:
&red,&green,&blue);
break;
}
+ case HCLpColorspace:
+ {
+ ModulateHCLp(percent_hue,percent_saturation,percent_brightness,
+ &red,&green,&blue);
+ break;
+ }
case HSBColorspace:
{
ModulateHSB(percent_hue,percent_saturation,percent_brightness,
&red,&green,&blue);
break;
}
+ case HSVColorspace:
+ {
+ ModulateHSV(percent_hue,percent_saturation,percent_brightness,
+ &red,&green,&blue);
+ break;
+ }
case HWBColorspace:
{
ModulateHWB(percent_hue,percent_saturation,percent_brightness,
break;
}
}
- if( IfMagickTrue(IssRGBColorspace(image->colorspace)) )
- {
- red=EncodePixelGamma(red);
- green=EncodePixelGamma(green);
- blue=EncodePixelGamma(blue);
- }
SetPixelRed(image,ClampToQuantum(red),q);
SetPixelGreen(image,ClampToQuantum(green),q);
SetPixelBlue(image,ClampToQuantum(blue),q);