Method: Magick::Image#mask
- Defined in:
- ext/RMagick/rmimage.cpp
#mask ⇒ Magick::Image? #mask(image) ⇒ Magick::Image?
Get/Sets an image clip mask created from the specified mask image. The mask image must have the same dimensions as the image being masked. If not, the mask image is resized to match. If the mask image has an alpha channel the opacity of each pixel is used to define the mask. Otherwise, the intensity (gray level) of each pixel is used.
In general, if the mask image does not have an alpha channel, a white pixel in the mask prevents changes to the corresponding pixel in the image being masked, while a black pixel allows changes. A pixel that is neither black nor white will allow partial changes depending on its intensity.
9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 |
# File 'ext/RMagick/rmimage.cpp', line 9292
VALUE
Image_mask(int argc, VALUE *argv, VALUE self)
{
VALUE mask;
Image *image;
image = rm_check_destroyed(self);
if (argc == 0)
{
return get_image_mask(image);
}
if (argc > 1)
{
rb_raise(rb_eArgError, "wrong number of arguments (expected 0 or 1, got %d)", argc);
}
rb_check_frozen(self);
mask = argv[0];
return set_image_mask(image, mask);
}
|