Method: Magick::Image#shade
- Defined in:
- ext/RMagick/rmimage.cpp
#shade(shading = false, azimuth = 30.0, elevation = 30.0) ⇒ Magick::Image
Shine a distant light on an image to create a three-dimensional effect. You control the positioning of the light with azimuth and elevation; azimuth is measured in degrees off the x axis and elevation is measured in pixels above the Z axis.
12936 12937 12938 12939 12940 12941 12942 12943 12944 12945 12946 12947 12948 12949 12950 12951 12952 12953 12954 12955 12956 12957 12958 12959 12960 12961 12962 12963 12964 12965 12966 12967 |
# File 'ext/RMagick/rmimage.cpp', line 12936
VALUE
Image_shade(int argc, VALUE *argv, VALUE self)
{
Image *image, *new_image;
double azimuth = 30.0, elevation = 30.0;
MagickBooleanType shading = MagickFalse;
ExceptionInfo *exception;
image = rm_check_destroyed(self);
switch (argc)
{
case 3:
elevation = NUM2DBL(argv[2]);
case 2:
azimuth = NUM2DBL(argv[1]);
case 1:
shading = (MagickBooleanType)RTEST(argv[0]);
case 0:
break;
default:
rb_raise(rb_eArgError, "wrong number of arguments (%d for 0 to 3)", argc);
break;
}
exception = AcquireExceptionInfo();
GVL_STRUCT_TYPE(ShadeImage) args = { image, shading, azimuth, elevation, exception };
new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ShadeImage), &args);
rm_check_exception(exception, new_image, DestroyOnError);
DestroyExceptionInfo(exception);
return rm_image_new(new_image);
}
|