de.matthiasmann.twl.renderer.lwjgl
Class LWJGLTexture

java.lang.Object
  extended by de.matthiasmann.twl.renderer.lwjgl.LWJGLTexture
All Implemented Interfaces:
QueriablePixels, Resource, Texture

public class LWJGLTexture
extends java.lang.Object
implements Texture, Resource, QueriablePixels

Simple texture implementation for TWL using LWJGL.


Nested Class Summary
static class LWJGLTexture.Filter
           
static class LWJGLTexture.Format
           
 
Nested classes/interfaces inherited from interface de.matthiasmann.twl.renderer.Texture
Texture.Rotation
 
Constructor Summary
LWJGLTexture(LWJGLRenderer renderer, int width, int height, java.nio.ByteBuffer buf, LWJGLTexture.Format fmt, LWJGLTexture.Filter filter)
           
 
Method Summary
 boolean bind()
           
 boolean bind(Color color)
           
 MouseCursor createCursor(int x, int y, int width, int height, int hotSpotX, int hotSpotY, Image imageRef)
           
 void destroy()
          After destroying a resurce it is no longer useable.
 int getHeight()
          Returns the height in pixels of this texture.
 Image getImage(int x, int y, int width, int height, Color tintColor, boolean tiled, Texture.Rotation rotation)
          Creates an image from a sub section of this texture.
 int getPixelValue(int x, int y)
          Returns the color value of the spicified pixel
 int getTexHeight()
           
 int getTexWidth()
           
 int getWidth()
          Returns the width in pixels of this texture.
 void themeLoadingDone()
          After calling this function getImage() and createCursor() may fail to work
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LWJGLTexture

public LWJGLTexture(LWJGLRenderer renderer,
                    int width,
                    int height,
                    java.nio.ByteBuffer buf,
                    LWJGLTexture.Format fmt,
                    LWJGLTexture.Filter filter)
Method Detail

destroy

public void destroy()
Description copied from interface: Resource
After destroying a resurce it is no longer useable.

Specified by:
destroy in interface Resource

getWidth

public int getWidth()
Description copied from interface: Texture
Returns the width in pixels of this texture.

Specified by:
getWidth in interface Texture
Returns:
the width in pixels of this texture.

getHeight

public int getHeight()
Description copied from interface: Texture
Returns the height in pixels of this texture.

Specified by:
getHeight in interface Texture
Returns:
the height in pixels of this texture.

getTexWidth

public int getTexWidth()

getTexHeight

public int getTexHeight()

bind

public boolean bind(Color color)

bind

public boolean bind()

getImage

public Image getImage(int x,
                      int y,
                      int width,
                      int height,
                      Color tintColor,
                      boolean tiled,
                      Texture.Rotation rotation)
Description copied from interface: Texture
Creates an image from a sub section of this texture.

Specified by:
getImage in interface Texture
Parameters:
x - left coordinate in the texture of the image
y - top coordinate in the texture of the image
width - width in pixels of the image - if negative the image is horizontaly flipped
height - height in pixels of the image - if negative the image is vertically flipped
tintColor - the tintColor - maybe null
tiled - true if this image should do tiled rendering
rotation - the rotation to apply to this sub section while rendering
Returns:
an image object
See Also:
Image.createTintedVersion(de.matthiasmann.twl.Color)

createCursor

public MouseCursor createCursor(int x,
                                int y,
                                int width,
                                int height,
                                int hotSpotX,
                                int hotSpotY,
                                Image imageRef)
Specified by:
createCursor in interface Texture

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()

themeLoadingDone

public void themeLoadingDone()
Description copied from interface: Texture
After calling this function getImage() and createCursor() may fail to work

Specified by:
themeLoadingDone in interface Texture