Method: Magick::Image#sigmoidal_contrast_channel
- Defined in:
- ext/RMagick/rmimage.cpp
#sigmoidal_contrast_channel(contrast = 3.0, midpoint = 50.0, sharpen = false, channel = Magick::AllChannels) ⇒ Magick::Image #sigmoidal_contrast_channel(contrast = 3.0, midpoint = 50.0, sharpen = false, *channels) ⇒ Magick::Image
Adjusts the contrast of an image channel with a non-linear sigmoidal contrast algorithm. Increases the contrast of the image using a sigmoidal transfer function without saturating highlights or shadows.
13198 13199 13200 13201 13202 13203 13204 13205 13206 13207 13208 13209 13210 13211 13212 13213 13214 13215 13216 13217 13218 13219 13220 13221 13222 13223 13224 13225 13226 13227 13228 13229 13230 13231 13232 13233 13234 13235 13236 13237 13238 13239 13240 13241 13242 13243 13244 13245 |
# File 'ext/RMagick/rmimage.cpp', line 13198
VALUE
Image_sigmoidal_contrast_channel(int argc, VALUE *argv, VALUE self)
{
Image *image, *new_image;
MagickBooleanType sharpen = MagickFalse;
double contrast = 3.0;
double midpoint = 50.0;
ChannelType channels;
#if defined(IMAGEMAGICK_7)
ExceptionInfo *exception;
#endif
image = rm_check_destroyed(self);
channels = extract_channels(&argc, argv);
switch (argc)
{
case 3:
sharpen = (MagickBooleanType) RTEST(argv[2]);
case 2:
midpoint = NUM2DBL(argv[1]);
case 1:
contrast = NUM2DBL(argv[0]);
case 0:
break;
default:
raise_ChannelType_error(argv[argc-1]);
break;
}
new_image = rm_clone_image(image);
#if defined(IMAGEMAGICK_7)
exception = AcquireExceptionInfo();
BEGIN_CHANNEL_MASK(new_image, channels);
GVL_STRUCT_TYPE(SigmoidalContrastImage) args = { new_image, sharpen, contrast, midpoint, exception };
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SigmoidalContrastImage), &args);
END_CHANNEL_MASK(new_image);
rm_check_exception(exception, new_image, DestroyOnError);
DestroyExceptionInfo(exception);
#else
GVL_STRUCT_TYPE(SigmoidalContrastImageChannel) args = { new_image, channels, sharpen, contrast, midpoint };
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SigmoidalContrastImageChannel), &args);
rm_check_image_exception(new_image, DestroyOnError);
#endif
return rm_image_new(new_image);
}
|