Method: Magick::Image#cycle_colormap

Defined in:
ext/RMagick/rmimage.cpp

#cycle_colormap(amount) ⇒ Magick::Image

Displaces the colormap by a given number of positions. If you cycle the colormap a number of times you can produce a psychedelic effect.

The returned image is always a PseudoClass image, regardless of the type of the original image.

Parameters:

  • amount (Numeric)

    amount to cycle the colormap

Returns:



5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
# File 'ext/RMagick/rmimage.cpp', line 5088

VALUE
Image_cycle_colormap(VALUE self, VALUE amount)
{
    Image *image, *new_image;
    int amt;
#if defined(IMAGEMAGICK_7)
    ExceptionInfo *exception;
#endif

    amt = NUM2INT(amount);

    image = rm_check_destroyed(self);
    new_image = rm_clone_image(image);

#if defined(IMAGEMAGICK_7)
    exception = AcquireExceptionInfo();
    GVL_STRUCT_TYPE(CycleColormapImage) args = { new_image, amt, exception };
    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CycleColormapImage), &args);
    rm_check_exception(exception, new_image, DestroyOnError);
    DestroyExceptionInfo(exception);
#else
    GVL_STRUCT_TYPE(CycleColormapImage) args = { new_image, amt };
    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CycleColormapImage), &args);
    rm_check_image_exception(new_image, DestroyOnError);
#endif

    return rm_image_new(new_image);
}