de.matthiasmann.twl.renderer.lwjgl
Class TextureArea

java.lang.Object
  extended by de.matthiasmann.twl.renderer.lwjgl.TextureAreaBase
      extended by de.matthiasmann.twl.renderer.lwjgl.TextureArea
All Implemented Interfaces:
Image, QueriablePixels, SupportsDrawRepeat
Direct Known Subclasses:
TextureAreaTiled

public class TextureArea
extends TextureAreaBase
implements Image, SupportsDrawRepeat, QueriablePixels

A area inside a OpenGL texture used as UI image


Field Summary
protected static int REPEAT_CACHE_SIZE
           
protected  int repeatCacheID
           
protected  LWJGLTexture texture
           
protected  Color tintColor
           
 
Fields inherited from class de.matthiasmann.twl.renderer.lwjgl.TextureAreaBase
height, tx0, tx1, ty0, ty1, width
 
Constructor Summary
TextureArea(LWJGLTexture texture, int x, int y, int width, int height, Color tintColor)
           
 
Method Summary
protected  void createRepeatCache()
           
 Image createTintedVersion(Color color)
          Creates a new image with is tinted with the specified color.
 void draw(AnimationState as, int x, int y)
          Draws the image in it's original size at the given location
 void draw(AnimationState as, int x, int y, int w, int h)
          Draws the image scaled to the given size at the given location
 void draw(AnimationState as, int x, int y, int width, int height, int repeatCountX, int repeatCountY)
           
protected  void drawRepeat(int x, int y, int repeatCountX, int repeatCountY)
           
protected  void drawRepeatCached(int x, int y, int repeatCountX, int repeatCountY)
           
 int getPixelValue(int x, int y)
          Returns the color value of the spicified pixel
 
Methods inherited from class de.matthiasmann.twl.renderer.lwjgl.TextureAreaBase
getHeight, getWidth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.matthiasmann.twl.renderer.Image
getHeight, getWidth
 

Field Detail

REPEAT_CACHE_SIZE

protected static final int REPEAT_CACHE_SIZE
See Also:
Constant Field Values

texture

protected final LWJGLTexture texture

tintColor

protected final Color tintColor

repeatCacheID

protected int repeatCacheID
Constructor Detail

TextureArea

public TextureArea(LWJGLTexture texture,
                   int x,
                   int y,
                   int width,
                   int height,
                   Color tintColor)
Method Detail

getPixelValue

public int getPixelValue(int x,
                         int y)
Description copied from interface: QueriablePixels
Returns the color value of the spicified pixel

Specified by:
getPixelValue in interface QueriablePixels
Parameters:
x - the X coordinate
y - the Y coordinate
Returns:
the ARGB value
See Also:
Color.toARGB()

draw

public void draw(AnimationState as,
                 int x,
                 int y)
Description copied from interface: Image
Draws the image in it's original size at the given location

Specified by:
draw in interface Image
Parameters:
as - A time source for animation - may be null
x - left coordinate
y - top coordinate

draw

public void draw(AnimationState as,
                 int x,
                 int y,
                 int w,
                 int h)
Description copied from interface: Image
Draws the image scaled to the given size at the given location

Specified by:
draw in interface Image
Parameters:
as - A time source for animation - may be null
x - left coordinate
y - top coordinate
w - the width in pixels
h - the height in pixels

draw

public void draw(AnimationState as,
                 int x,
                 int y,
                 int width,
                 int height,
                 int repeatCountX,
                 int repeatCountY)
Specified by:
draw in interface SupportsDrawRepeat

drawRepeat

protected void drawRepeat(int x,
                          int y,
                          int repeatCountX,
                          int repeatCountY)

drawRepeatCached

protected void drawRepeatCached(int x,
                                int y,
                                int repeatCountX,
                                int repeatCountY)

createRepeatCache

protected void createRepeatCache()

createTintedVersion

public Image createTintedVersion(Color color)
Description copied from interface: Image
Creates a new image with is tinted with the specified color. Tinting works by multiplying the color of the image's pixels with the specified color.

Specified by:
createTintedVersion in interface Image
Parameters:
color - The color used for tinting.
Returns:
a new Image object.