sdljava.image

Class SDLImage

public class SDLImage extends Object

SDL_image is an image loading library that is used with the SDL library, and almost as portable. It allows a programmer to use multiple image formats without having to code all the loading and conversion algorithms themselves.

Version: $Id: SDLImage.java,v 1.4 2005/01/07 04:01:43 ivan_ganza Exp $

Author: Ivan Z. Ganza

Method Summary
static SDLSurfaceload(String file)
Load file for use as an image in a new surface.
static SDLSurfaceload(Buffer buf)
Load file for use as an image in a new surface.
static SDLSurfaceload(byte[] data)
Load file for use as an image in a new surface.
static SDLSurfaceload(URL url)
Load file for use as an image in a new surface.
static SDLSurfaceload(InputStream in)
Load file for use as an image in a new surface.

Method Detail

load

public static SDLSurface load(String file)
Load file for use as an image in a new surface. This actually calls IMG_LoadTyped_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.

Parameters: file Path to image file

Returns: The loaded image as an SDLSurface

Throws: SDLException if an error occurs

load

public static SDLSurface load(Buffer buf)
Load file for use as an image in a new surface. This actually calls IMG_LoadTyped_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.

Parameters: buf a DIRECT Buffer value with the image data

Returns: The loaded image as an SDLSurface

Throws: SDLException if an error occurs

load

public static SDLSurface load(byte[] data)
Load file for use as an image in a new surface. This actually calls IMG_LoadTyped_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.

Parameters: data a byte[] value

Returns: The loaded image as an SDLSurface

Throws: SDLException if an error occurs

This method automatically creates the NIO Direct Buffer from the given byte array

load

public static SDLSurface load(URL url)
Load file for use as an image in a new surface. This actually calls IMG_LoadTyped_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.

Parameters: url an URL value

Returns: The loaded image as an SDLSurface

Throws: SDLException if an error occurs

This method automatically creates the NIO Direct Buffer

load

public static SDLSurface load(InputStream in)
Load file for use as an image in a new surface. This actually calls IMG_LoadTyped_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.

Parameters: in an InputStream value

Returns: The loaded image as an SDLSurface

Throws: SDLException if an error occurs

This method automatically creates the NIO Direct Buffer