Method: Magick::Image#set_channel_depth

Defined in:
ext/RMagick/rmimage.cpp

#set_channel_depth(channel_arg, depth) ⇒ Object

Sets the depth of the image channel.

Parameters:

  • channel_arg (Magick::ChannelType)

    the channel

  • depth (Numeric)

    the depth

Returns:

  • self



12650
12651
12652
12653
12654
12655
12656
12657
12658
12659
12660
12661
12662
12663
12664
12665
12666
12667
12668
12669
12670
12671
12672
12673
12674
12675
12676
12677
12678
12679
12680
# File 'ext/RMagick/rmimage.cpp', line 12650

VALUE
Image_set_channel_depth(VALUE self, VALUE channel_arg, VALUE depth)
{
    Image *image;
    ChannelType channel;
    unsigned long channel_depth;
#if defined(IMAGEMAGICK_7)
    ExceptionInfo *exception;
#endif

    image = rm_check_frozen(self);

    VALUE_TO_ENUM(channel_arg, channel, ChannelType);
    channel_depth = NUM2ULONG(depth);

#if defined(IMAGEMAGICK_7)
    exception = AcquireExceptionInfo();
    BEGIN_CHANNEL_MASK(image, channel);
    GVL_STRUCT_TYPE(SetImageDepth) args = { image, channel_depth, exception };
    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageDepth), &args);
    END_CHANNEL_MASK(image);
    CHECK_EXCEPTION();
    DestroyExceptionInfo(exception);
#else
    GVL_STRUCT_TYPE(SetImageChannelDepth) args = { image, channel, channel_depth };
    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageChannelDepth), &args);
    rm_check_image_exception(image, RetainOnError);
#endif

    return self;
}