| Module | Rubygame::Image |
| In: |
ext/rubygame/rubygame_transform.c
|
The Image module contains methods for saving and loading image files to Surfaces.
The load method is only usable if Rubygame was compiled with the SDL_image library. You may test if this feature is available with the usable? method. If you need more flexibility, you can check the library version that Rubygame was compiled against with the version method.
At this time, no method is available to load BMP files without SDL_image, so it must be present to do any sort of image file loading. This will be remedied in the future.
Load an image file from the disk to a Surface. If the image has an alpha channel (e.g. PNG with transparency), the Surface will as well. If the image cannot be loaded (for example if the image format is unsupported), will raise SDLError.
This method is only usable if Rubygame was compiled with the SDL_image library. You may test if this feature is available with the usable? method. If you need more flexibility, you can check the library version that Rubygame was compiled against with the version method.
This method takes this argument:
| filename: | a string containing the relative or absolute path to the image file. The file must have the proper file extension, as it is used to determine image format. |
These formats may be supported, but some may not be available on a particular system.
| BMP: | "Windows Bitmap" format. |
| GIF: | "Graphics Interchange Format." |
| JPG: | "Independent JPEG Group" format. |
| LBM: | "Linear Bitmap" format (?) |
| PCX: | "PC Paintbrush" format |
| PNG: | "Portable Network Graphics" format. |
| PNM: | "Portable Any Map" format. (i.e., PPM, PGM, or PBM) |
| TGA: | "Truevision TARGA" format. |
| TIF: | "Tagged Image File Format" |
| XCF: | "eXperimental Computing Facility" (GIMP native format). |
| XPM: | "XPixMap" format. |
Returns true if the feature(s) associated with this module/class are available for use. This means that Rubygame was compiled and linked against the C library which provides the feature, i.e. SDL_gfx, SDL_image, or SDL_ttf.
If the features are not available (for example, if the libraries were not installed or detected when Rubygame was compiled), returns false.
Return the major, minor, and patch numbers for the version of SDL_image that Rubygame was compiled with. If Rubygame was not compiled with SDL_image, all version numbers will be 0 (zero), and you should not attempt to use load.
This allows for more flexible detection of the capabilities of the base library, SDL_image. See also usable?.