Method: Magick::Image#raise

Defined in:
ext/RMagick/rmimage.cpp

#raise(width = 6, height = 6, raised = true) ⇒ Magick::Image

Create a simulated three-dimensional button-like effect by lightening and darkening the edges of the image. The “width” and “height” arguments define the width of the vertical and horizontal edge of the effect. If “raised” is true, creates a raised effect, otherwise a lowered effect.

Returns a new image.

Parameters:

  • width (Numeric) (defaults to: 6)

    The width of the raised edge in pixels.

  • height (Numeric) (defaults to: 6)

    The height of the raised edge in pixels.

  • raised (Boolean) (defaults to: true)

    If true, the image is raised, otherwise lowered.

Returns:



11432
11433
11434
11435
11436
11437
11438
11439
11440
11441
11442
11443
11444
11445
11446
11447
11448
11449
11450
11451
11452
11453
11454
11455
11456
11457
11458
11459
11460
11461
11462
11463
11464
11465
11466
11467
11468
11469
11470
11471
11472
11473
11474
11475
11476
11477
# File 'ext/RMagick/rmimage.cpp', line 11432

VALUE
Image_raise(int argc, VALUE *argv, VALUE self)
{
    Image *image, *new_image;
    RectangleInfo rect;
    MagickBooleanType raised = MagickTrue;      // default
#if defined(IMAGEMAGICK_7)
    ExceptionInfo *exception;
#endif

    memset(&rect, 0, sizeof(rect));
    rect.width = 6;         // default
    rect.height = 6;        // default

    image = rm_check_destroyed(self);
    switch (argc)
    {
        case 3:
            raised = (MagickBooleanType)RTEST(argv[2]);
        case 2:
            rect.height = NUM2ULONG(argv[1]);
        case 1:
            rect.width = NUM2ULONG(argv[0]);
        case 0:
            break;
        default:
            rb_raise(rb_eArgError, "wrong number of arguments (%d for 0 to 3)", argc);
            break;
    }

    new_image = rm_clone_image(image);

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

    return rm_image_new(new_image);
}