SDL::Image - Bindings for the SDL_Image library
SDL::Image allows you to load many different format of images into memory as an SDL::Surface.
The following types are supported:
TODO, SDL, Image
my $surface = SDL::Image::load( $file );
$file Image file name to load a surface from.
Load file for use as an image in a new SDL::Surface. This actually calls IMG_LoadTyped_RW
the binded function to SDL::Image::load_typed_rw, with the file extension used as the type string. This can load all supported image files, including TGA as long as the filename ends with ".tga". It is best to call this outside of event loops, and rather keep the loaded images around until you are really done with them, as disk speed and image conversion to a surface is not that speedy.
Note: If the image format loader requires initialization, it will attempt to do that the first time it is needed if you have not already called IMG_Init to load support for your image format.
Note: If the image format supports a transparent pixel, SDL_image will set the colorkey for the surface. You can enable RLE acceleration on the surface afterwards by calling:
SDL::Video::set_color_key($image, SDL_RLEACCEL, $image->format->colorkey);
An image as a SDL::Surface. NULL is returned on errors, such as no support built for the image, or a file reading error. Use SDL::get_error to get cause of error.
Provides the version of linked sdl_image library. see SDL::Version
my $version = SDL::Image::linked_version(); print $version->major.' '.$version->minor.' '.$version->patch;
For version SDL_image 1.2.10 and up
bitwise OR'd set of image formats to support by loading a library now. The values you may OR together to pass in are:
Initialize by loading support as indicated by the flags, or at least return success if support is already loaded. You may call this multiple times, which will actually require you to call IMG_Quit just once to clean up. You may call this function with a 0 to retrieve whether support was built-in or not loaded yet. Note: to load JPG, PNG, and/or TIF images you can call IMG_Init with the right IMG_INIT_* flags OR'd together before you program gets busy, to prevent a later hiccup while it loads the library, and to check that you do have the support that you need before you try and use it. Note: No initialization is needed nor performed when using the SDL::Image::is_JPG, SDL::Image::is_PNG, and SDL::Image::is_TIF functions. Note: this function does not always set the error string, so do not depend on SDL::Image::get_error being meaningful all the time.
A bitmask of all the currentl initted image loaders.
use SDL::Image; my $flags = IMG_INIT_JPG | IMG_INIT_PNG | IMG_INIT_JPG; my $inited = SDL::Image::init($flags);