de.rico.engine.effect.ortho
Class OverlayImage

java.lang.Object
  extended by de.rico.engine.effect.ortho.OverlayImage
Direct Known Subclasses:
GameCursor

public class OverlayImage
extends java.lang.Object

This class encapsulates an image file to be ready for rendering with the ImageRenderer.

Note: You can even use images with transparency (like .png files) and the transparent areas will stay transparent.

Author:
Frank Bruns

Constructor Summary
OverlayImage(java.lang.String filePath)
          Creates a new overlay image from the specified image.
OverlayImage(java.lang.String filePath, int width, int height)
          Creates a new overlay image from the specified image.
 
Method Summary
 java.lang.String getFilePath()
          Returns the file path of the image.
 int getHeight()
          Returns the height of the overlay image in pixels.
 com.sun.opengl.util.texture.Texture getImage()
          Returns the image (which is actually a texture object).
 int getWidth()
          Returns the width of the overlay image in pixels.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OverlayImage

public OverlayImage(java.lang.String filePath)
Creates a new overlay image from the specified image.

Parameters:
filePath - file path to image

OverlayImage

public OverlayImage(java.lang.String filePath,
                    int width,
                    int height)
Creates a new overlay image from the specified image. This contructor allows the user to set the dimension of the image manually. The image will get streched or shrinked to these dimensions, if neccessary.

Parameters:
filePath - file path to image
width - width for the image
height - height for the image
Method Detail

getImage

public com.sun.opengl.util.texture.Texture getImage()
Returns the image (which is actually a texture object).
Note: The width/height returned by the texture's methods can be different from the width/height that was set to draw the image in. Better don't use the texture's methods to get its dimensions.

Returns:
overlay image

getWidth

public int getWidth()
Returns the width of the overlay image in pixels.

Returns:
width of overlay image (in pixels)

getHeight

public int getHeight()
Returns the height of the overlay image in pixels.

Returns:
height of overlay image (in pixels)

getFilePath

public java.lang.String getFilePath()
Returns the file path of the image.

Returns:
path to the image file