com.threerings.opengl.gui
Class Image

java.lang.Object
  extended by com.threerings.opengl.gui.Image

public class Image
extends Object

Contains a texture and its dimensions.


Field Summary
protected  int _height
           
protected  BufferedImage _image
           
protected static boolean _supportsNonPowerOfTwo
           
protected  int _theight
           
protected  int _twidth
           
protected  TextureUnit[] _units
           
protected  int _width
           
 
Constructor Summary
  Image(BufferedImage image)
          Creates an image from the supplied source AWT image.
protected Image(int width, int height)
          Helper constructor.
  Image(Texture2D texture)
          Creates an image from an existing texture.
  Image(Texture2D texture, int width, int height)
          Creates an image from an existing texture.
  Image(URL image)
          Creates an image from the supplied source URL.
 
Method Summary
static void configureTexture(Texture2D texture)
          Configures a texture for use as an image.
 int getHeight()
          Returns the height of this image.
 Texture2D getTexture(Renderer renderer)
          Returns a reference to the image texture, loading it if necessary.
 int getWidth()
          Returns the width of this image.
 void load(Renderer renderer, int format)
          Loads the image into a texture (this is called automatically when first used and need only be called manually if a specific format is desired).
 void render(Renderer renderer, int tx, int ty, Color4f color, float alpha)
          Renders this image at the specified coordinates in the specified color.
 void render(Renderer renderer, int tx, int ty, float alpha)
          Renders this image at the specified coordinates.
 void render(Renderer renderer, int tx, int ty, int twidth, int theight, float alpha)
          Renders this image at the specified coordinates, scaled to the specified size.
 void render(Renderer renderer, int sx, int sy, int swidth, int sheight, int tx, int ty, float alpha)
          Renders a region of this image at the specified coordinates.
 void render(Renderer renderer, int sx, int sy, int swidth, int sheight, int tx, int ty, int twidth, int theight, Color4f color, float alpha)
          Renders a region of this image at the specified coordinates, scaled to the specified size, in the specified color.
 void render(Renderer renderer, int sx, int sy, int swidth, int sheight, int tx, int ty, int twidth, int theight, float alpha)
          Renders a region of this image at the specified coordinates, scaled to the specified size.
protected  void setTexture(Texture2D texture)
          Sets the image texture.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_width

protected int _width

_height

protected int _height

_twidth

protected int _twidth

_theight

protected int _theight

_image

protected BufferedImage _image

_units

protected TextureUnit[] _units

_supportsNonPowerOfTwo

protected static boolean _supportsNonPowerOfTwo
Constructor Detail

Image

public Image(URL image)
      throws IOException
Creates an image from the supplied source URL.

Throws:
IOException

Image

public Image(BufferedImage image)
Creates an image from the supplied source AWT image.


Image

public Image(Texture2D texture)
Creates an image from an existing texture.


Image

public Image(Texture2D texture,
             int width,
             int height)
Creates an image from an existing texture.


Image

protected Image(int width,
                int height)
Helper constructor.

Method Detail

configureTexture

public static void configureTexture(Texture2D texture)
Configures a texture for use as an image.


getWidth

public int getWidth()
Returns the width of this image.


getHeight

public int getHeight()
Returns the height of this image.


getTexture

public Texture2D getTexture(Renderer renderer)
Returns a reference to the image texture, loading it if necessary.


render

public void render(Renderer renderer,
                   int tx,
                   int ty,
                   float alpha)
Renders this image at the specified coordinates.


render

public void render(Renderer renderer,
                   int tx,
                   int ty,
                   Color4f color,
                   float alpha)
Renders this image at the specified coordinates in the specified color.


render

public void render(Renderer renderer,
                   int tx,
                   int ty,
                   int twidth,
                   int theight,
                   float alpha)
Renders this image at the specified coordinates, scaled to the specified size.


render

public void render(Renderer renderer,
                   int sx,
                   int sy,
                   int swidth,
                   int sheight,
                   int tx,
                   int ty,
                   float alpha)
Renders a region of this image at the specified coordinates.


render

public void render(Renderer renderer,
                   int sx,
                   int sy,
                   int swidth,
                   int sheight,
                   int tx,
                   int ty,
                   int twidth,
                   int theight,
                   float alpha)
Renders a region of this image at the specified coordinates, scaled to the specified size.


render

public void render(Renderer renderer,
                   int sx,
                   int sy,
                   int swidth,
                   int sheight,
                   int tx,
                   int ty,
                   int twidth,
                   int theight,
                   Color4f color,
                   float alpha)
Renders a region of this image at the specified coordinates, scaled to the specified size, in the specified color.


load

public void load(Renderer renderer,
                 int format)
Loads the image into a texture (this is called automatically when first used and need only be called manually if a specific format is desired).

Parameters:
format - the internal format to use for the texture, or -1 to use the default.

setTexture

protected void setTexture(Texture2D texture)
Sets the image texture.