de.matthiasmann.twl.renderer.lwjgl
Class LWJGLDynamicImage

java.lang.Object
  extended by de.matthiasmann.twl.renderer.lwjgl.TextureAreaBase
      extended by de.matthiasmann.twl.renderer.lwjgl.LWJGLDynamicImage
All Implemented Interfaces:
DynamicImage, Image, Resource

public class LWJGLDynamicImage
extends TextureAreaBase
implements DynamicImage


Nested Class Summary
 
Nested classes/interfaces inherited from interface de.matthiasmann.twl.renderer.DynamicImage
DynamicImage.Format
 
Field Summary
 
Fields inherited from class de.matthiasmann.twl.renderer.lwjgl.TextureAreaBase
height, tx0, tx1, ty0, ty1, width
 
Constructor Summary
LWJGLDynamicImage(LWJGLRenderer renderer, int target, int id, int width, int height, int texWidth, int texHeight, Color tintColor)
           
 
Method Summary
 Image createTintedVersion(Color color)
          Creates a new image with is tinted with the specified color.
 void destroy()
          After destroying a resurce it is no longer useable.
 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 width, int height)
          Draws the image scaled to the given size at the given location
 void update(java.nio.ByteBuffer data, DynamicImage.Format format)
          Updates the complete image.
 void update(java.nio.ByteBuffer data, int stride, DynamicImage.Format format)
          Updates the complete image.
 void update(int xoffset, int yoffset, int width, int height, java.nio.ByteBuffer data, DynamicImage.Format format)
          Updates a region of the image with new data.
 void update(int xoffset, int yoffset, int width, int height, java.nio.ByteBuffer data, int stride, DynamicImage.Format format)
          Updates a region of the image with new data.
 
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
 

Constructor Detail

LWJGLDynamicImage

public LWJGLDynamicImage(LWJGLRenderer renderer,
                         int target,
                         int id,
                         int width,
                         int height,
                         int texWidth,
                         int texHeight,
                         Color tintColor)
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

update

public void update(java.nio.ByteBuffer data,
                   DynamicImage.Format format)
Description copied from interface: DynamicImage
Updates the complete image.

Specified by:
update in interface DynamicImage
Parameters:
data - The new texels
format - The format of the texel data

update

public void update(java.nio.ByteBuffer data,
                   int stride,
                   DynamicImage.Format format)
Description copied from interface: DynamicImage
Updates the complete image.

Specified by:
update in interface DynamicImage
Parameters:
data - The new texels
stride - The number of bytes from one row to the next
format - The format of the texel data

update

public void update(int xoffset,
                   int yoffset,
                   int width,
                   int height,
                   java.nio.ByteBuffer data,
                   DynamicImage.Format format)
Description copied from interface: DynamicImage
Updates a region of the image with new data.

Specified by:
update in interface DynamicImage
Parameters:
xoffset - Specifies a texel offset in the x direction within the image
yoffset - Specifies a texel offset in the y direction within the image
width - Specifies the width of the update area
height - Specifies the height of the update area
data - The new texels
format - The format of the texel data

update

public void update(int xoffset,
                   int yoffset,
                   int width,
                   int height,
                   java.nio.ByteBuffer data,
                   int stride,
                   DynamicImage.Format format)
Description copied from interface: DynamicImage
Updates a region of the image with new data.

Specified by:
update in interface DynamicImage
Parameters:
xoffset - Specifies a texel offset in the x direction within the image
yoffset - Specifies a texel offset in the y direction within the image
width - Specifies the width of the update area
height - Specifies the height of the update area
data - The new texels
stride - The number of bytes from one row to the next
format - The format of the texel data

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.

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 width,
                 int height)
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
width - the width in pixels
height - the height in pixels