Method: Magick::Image#remap
- Defined in:
- ext/RMagick/rmimage.cpp
#remap(remap_image, dither_method = Magick::RiemersmaDitherMethod) ⇒ Object Also known as: affinity
Reduce the number of colors in img to the colors used by remap_image. If a dither method is specified then the given colors are dithered over the image as necessary, otherwise the closest color (in RGB colorspace) is selected to replace that pixel in the image.
11827 11828 11829 11830 11831 11832 11833 11834 11835 11836 11837 11838 11839 11840 11841 11842 11843 11844 11845 11846 11847 11848 11849 11850 11851 11852 11853 11854 11855 11856 11857 11858 11859 11860 11861 11862 11863 11864 11865 11866 11867 11868 11869 11870 |
# File 'ext/RMagick/rmimage.cpp', line 11827
VALUE
Image_remap(int argc, VALUE *argv, VALUE self)
{
Image *image, *remap_image;
QuantizeInfo quantize_info;
#if defined(IMAGEMAGICK_7)
ExceptionInfo *exception;
#endif
image = rm_check_frozen(self);
GetQuantizeInfo(&quantize_info);
switch (argc)
{
case 2:
VALUE_TO_ENUM(argv[1], quantize_info.dither_method, DitherMethod);
#if defined(IMAGEMAGICK_6)
quantize_info.dither = MagickTrue;
#endif
break;
case 1:
break;
default:
rb_raise(rb_eArgError, "wrong number of arguments (%d for 1 or 2)", argc);
break;
}
remap_image = rm_check_destroyed(rm_cur_image(argv[0]));
#if defined(IMAGEMAGICK_7)
exception = AcquireExceptionInfo();
GVL_STRUCT_TYPE(RemapImage) args = { &quantize_info, image, remap_image, exception };
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RemapImage), &args);
CHECK_EXCEPTION();
DestroyExceptionInfo(exception);
#else
GVL_STRUCT_TYPE(RemapImage) args = { &quantize_info, image, remap_image };
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RemapImage), &args);
rm_check_image_exception(image, RetainOnError);
#endif
return self;
}
|