Method: Magick::Image#channel
- Defined in:
- ext/RMagick/rmimage.cpp
#channel(channel_arg) ⇒ Magick::Image
Extract a channel from the image. A channel is a particular color component of each pixel in the image.
2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 |
# File 'ext/RMagick/rmimage.cpp', line 2405
VALUE
Image_channel(VALUE self, VALUE channel_arg)
{
Image *image, *new_image;
ChannelType channel;
#if defined(IMAGEMAGICK_7)
ExceptionInfo *exception;
#endif
image = rm_check_destroyed(self);
VALUE_TO_ENUM(channel_arg, channel, ChannelType);
#if defined(IMAGEMAGICK_7)
exception = AcquireExceptionInfo();
GVL_STRUCT_TYPE(SeparateImage) args = { image, channel, exception };
new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SeparateImage), &args);
rm_check_exception(exception, new_image, DestroyOnError);
DestroyExceptionInfo(exception);
#else
new_image = rm_clone_image(image);
GVL_STRUCT_TYPE(SeparateImageChannel) args = { new_image, channel };
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SeparateImageChannel), &args);
rm_check_image_exception(new_image, DestroyOnError);
#endif
return rm_image_new(new_image);
}
|