sdljava.image
Class SDLImage

java.lang.Object
  extended by sdljava.image.SDLImage

public class SDLImage
extends java.lang.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

Constructor Summary
SDLImage()
           
 
Method Summary
static SDLSurface load(java.nio.Buffer buf)
          Load file for use as an image in a new surface.
static SDLSurface load(byte[] data)
          Load file for use as an image in a new surface.
static SDLSurface load(java.io.InputStream in)
          Load file for use as an image in a new surface.
static SDLSurface load(java.lang.String file)
          Load file for use as an image in a new surface.
static SDLSurface load(java.net.URL url)
          Load file for use as an image in a new surface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SDLImage

public SDLImage()
Method Detail

load

public static SDLSurface load(java.lang.String file)
                       throws SDLException
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(java.nio.Buffer buf)
                       throws SDLException
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)
                       throws SDLException
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(java.net.URL url)
                       throws SDLException,
                              java.io.IOException,
                              java.net.MalformedURLException
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

java.io.IOException
java.net.MalformedURLException

load

public static SDLSurface load(java.io.InputStream in)
                       throws SDLException,
                              java.io.IOException
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

java.io.IOException