Module: SDL2::IMG

Defined in:
video.c,
video.c

Overview

This module provides the interface to SDL_image. You can load many kinds of image files using this modules.

This module provides only initialization interface IMG.init. After calling init, you can load image files using Surface.load.

Constant Summary collapse

INIT_JPG =

Returns Initialize the JPEG loader.

Returns:

  • (Integer)

    Initialize the JPEG loader

INT2NUM(IMG_INIT_JPG)
INIT_PNG =

Returns Initialize the PNG loader.

Returns:

  • (Integer)

    Initialize the PNG loader

INT2NUM(IMG_INIT_PNG)
INIT_TIF =

Returns Initialize the TIF loader.

Returns:

  • (Integer)

    Initialize the TIF loader

INT2NUM(IMG_INIT_TIF)
INIT_WEBP =

Returns Initialize the WEBP loader.

Returns:

  • (Integer)

    Initialize the WEBP loader

INT2NUM(IMG_INIT_WEBP)

Class Method Summary collapse

Class Method Details

.init(flags) ⇒ nil

Initialize SDL_image.

You can specify the supporting image formats by bitwise OR’d of the following constants.

You need to initialize SDL_image to check whether specified format is supported by your environment. If your environment does not support required support format, you have a Error exception.

Parameters:

  • flags (Integer)

    submodule bits

Returns:

  • (nil)

Raises:

  • (SDL2::Error)

    raised when initializing is failed.



3563
3564
3565
3566
3567
3568
3569
# File 'video.c', line 3563

static VALUE IMG_s_init(VALUE self, VALUE f)
{
    int flags = NUM2INT(f);
    if ((IMG_Init(flags) & flags) != flags)
        rb_raise(eSDL2Error, "Couldn't initialze SDL_image");
    return Qnil;
}