ThrowImageException;
}
+void Magick::Image::localContrastChannel(const ChannelType channel_,
+ const double radius_,const double strength_)
+{
+ MagickCore::Image
+ *newImage;
+
+ GetPPException;
+ GetAndSetPPChannelMask(channel_);
+ newImage=LocalContrastImage(constImage(),radius_,strength_,exceptionInfo);
+ RestorePPChannelMask;
+ replaceImage(newImage);
+ ThrowImageException;
+}
+
void Magick::Image::magnify(void)
{
MagickCore::Image
// Local contrast enhancement
void localContrast(const double radius_,const double strength_);
+ void localContrastChannel(const ChannelType channel_,const double radius_,
+ const double strength_);
// Magnify image by integral size
void magnify(void);
sum,
weight;
+ PixelTrait
+ traits;
+
weight=1.0f;
sum=0;
pix=pixels+x;
srcVal=(float) GetPixelLuma(image,p);
mult=(srcVal-(sum/totalWeight))*(strength/100.0f);
mult=(srcVal+mult)/srcVal;
- SetPixelRed(contrast_image,ClampToQuantum(GetPixelRed(image,p)*mult),
- q);
- SetPixelGreen(contrast_image,ClampToQuantum(GetPixelGreen(image,p)*
- mult),q);
- SetPixelBlue(contrast_image,ClampToQuantum(GetPixelBlue(image,p)*mult),
- q);
+ traits=GetPixelChannelTraits(image,RedPixelChannel);
+ if ((traits & UpdatePixelTrait) != 0)
+ SetPixelRed(contrast_image,ClampToQuantum(GetPixelRed(image,p)*mult),
+ q);
+ traits=GetPixelChannelTraits(image,GreenPixelChannel);
+ if ((traits & UpdatePixelTrait) != 0)
+ SetPixelGreen(contrast_image,ClampToQuantum(GetPixelGreen(image,p)*
+ mult),q);
+ traits=GetPixelChannelTraits(image,BluePixelChannel);
+ if ((traits & UpdatePixelTrait) != 0)
+ SetPixelBlue(contrast_image,ClampToQuantum(GetPixelBlue(image,p)*
+ mult),q);
p+=image->number_channels;
q+=contrast_image->number_channels;
}