public class TextureAtlas extends Object
Constructor and Description |
---|
TextureAtlas()
Constructs a new TextureAtlas with default initial width and height, with
smoothing enabled.
|
TextureAtlas(int initialWidth,
int initialHeight)
Constructs a new TextureAtlas with the provided initial width and height
in pixels, with smoothing enabled.
|
TextureAtlas(int initialWidth,
int initialHeight,
boolean smoothing)
Constructs a new TextureAtlas with the provided initial width and height
in pixels.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(TextureAtlasUpdateListener listener)
Registers a TextureAtlasUpdateListener with the TextureAtlas.
|
void |
beginRendering()
Readies the TextureAtlas for drawing.
|
void |
deleteImage(Object id)
Removes an image from the TextureAtlas based on its unique identifier (which is often a String).
|
void |
dispose()
Disposes of the OpenGL resources associated with this TextureAtlas.
|
void |
drawImage(javax.media.opengl.GL2 gl,
Object id,
Axis2D axis,
double positionX,
double positionY) |
void |
drawImage(javax.media.opengl.GL2 gl,
Object id,
Axis2D axis,
double positionX,
double positionY,
double scale) |
void |
drawImage(javax.media.opengl.GL2 gl,
Object id,
Axis2D axis,
double positionX,
double positionY,
double scaleX,
double scaleY) |
void |
drawImage(javax.media.opengl.GL2 gl,
Object id,
Axis2D axis,
double positionX,
double positionY,
double scaleX,
double scaleY,
int centerX,
int centerY)
Draws an image from the TextureAtlas using the given GL handle.
|
void |
drawImage(javax.media.opengl.GL2 gl,
Object id,
int positionX,
int positionY) |
void |
drawImage(javax.media.opengl.GL2 gl,
Object id,
int positionX,
int positionY,
double scaleX,
double scaleY) |
void |
drawImage(javax.media.opengl.GL2 gl,
Object id,
int positionX,
int positionY,
double scaleX,
double scaleY,
int centerX,
int centerY) |
void |
drawImageAxisX(javax.media.opengl.GL2 gl,
Object id,
Axis1D axis,
double positionX,
double positionY) |
void |
drawImageAxisX(javax.media.opengl.GL2 gl,
Object id,
Axis1D axis,
double positionX,
double positionY,
double scaleX,
double scaleY,
int centerX,
int centerY)
Draws an image from the TextureAtlas with the x position specified in axis space
and the y position specified in pixel space.
|
void |
drawImageAxisY(javax.media.opengl.GL2 gl,
Object id,
Axis1D axis,
double positionX,
double positionY)
Draws an image from the TextureAtlas with the y position specified in axis space
and the x position specified in pixel space.
|
void |
drawImageAxisY(javax.media.opengl.GL2 gl,
Object id,
Axis1D axis,
double positionX,
double positionY,
double scaleX,
double scaleY,
int centerX,
int centerY) |
void |
endRendering()
Resets OpenGL state.
|
ImageData |
getImageData(Object id)
Returns information about an image in the TextureAtlas.
|
boolean |
isImageLoaded(Object id)
Verifies whether or not an image has been loaded into the TextureAtlas.
|
void |
loadImage(Object id,
BufferedImage image)
Adds an image, defined by a BufferedImage, to the TextureAtlas.
|
void |
loadImage(Object id,
BufferedImage image,
int centerX,
int centerY)
Adds an image, defined by a BufferedImage, to the TextureAtlas.
|
void |
loadImage(Object id,
int width,
int height,
ImageDrawer drawer)
Adds an image, defined by an arbitrary Java2D drawing routine, to the TextureAtlas.
|
void |
loadImage(Object id,
int width,
int height,
int centerX,
int centerY,
ImageDrawer drawer)
Adds an image, defined by an arbitrary Java2D drawing routine, to the TextureAtlas.
|
void |
removeListener(TextureAtlasUpdateListener listener) |
public TextureAtlas(int initialWidth, int initialHeight, boolean smoothing)
initalWidth
- initialHeight
- smoothing
- public TextureAtlas(int initialWidth, int initialHeight)
TextureAtlas( int, int, boolean )
public TextureAtlas()
TextureAtlas( int, int, boolean )
public void addListener(TextureAtlasUpdateListener listener)
listener
- public void removeListener(TextureAtlasUpdateListener listener)
public void loadImage(Object id, BufferedImage image, int centerX, int centerY)
id
- the unique identifier for the imageimage
- a BufferedImage to be loaded into the texturecenterX
- the center x pixel of the imagecenterY
- the center y pixel of the imagepublic void loadImage(Object id, BufferedImage image)
id
- the unique identifier for the imageimage
- a BufferedImage to be loaded into the textureloadImage( Object, BufferedImage, int, int )
public void loadImage(Object id, int width, int height, ImageDrawer drawer)
id
- the unique identifier for the imagewidth
- the width of the imageheight
- the height of the imagedrawer
- a Java2D drawing routine which defines the imagepublic void loadImage(Object id, int width, int height, int centerX, int centerY, ImageDrawer drawer)
id
- the unique identifier for the imagewidth
- the width of the imageheight
- the height of the imagecenterX
- the center x pixel of the imagecenterY
- the center y pixel of the imagedrawer
- a Java2D drawing routine which defines the imageloadImage( Object, int, int, int, int, ImageDrawer )
public void deleteImage(Object id)
id
- the unique identifier for the image to be deletedpublic boolean isImageLoaded(Object id)
beginRendering( )
must have been made before getImageData( Object )
will return data for the image.id
- the unique identifier for the imagepublic ImageData getImageData(Object id)
IconPainter
which are
backed by a TextureAtlas.id
- the unique identifier for the imagepublic void drawImage(javax.media.opengl.GL2 gl, Object id, Axis2D axis, double positionX, double positionY)
#drawImage( GL, Object, Axis2D, float, float, float, float, int, int )
public void drawImage(javax.media.opengl.GL2 gl, Object id, Axis2D axis, double positionX, double positionY, double scale)
#drawImage( GL, Object, Axis2D, float, float, float, float, int, int )
public void drawImage(javax.media.opengl.GL2 gl, Object id, Axis2D axis, double positionX, double positionY, double scaleX, double scaleY)
#drawImage( GL, Object, Axis2D, float, float, float, float, int, int )
public void drawImage(javax.media.opengl.GL2 gl, Object id, Axis2D axis, double positionX, double positionY, double scaleX, double scaleY, int centerX, int centerY)
IconPainter
. For even more
specific use cases, custom painters may be required.gl
- handle from the current OpenGL contextid
- an icon loaded into the atlas using a loadImage() methodaxis
- positionX
- the x position in axis space of the center pixel in the imagepositionY
- the y position in axis space of the center pixel in the imagescaleX
- the scale factor in the x directionscaleY
- the scale factor in the y directionoffsetX
- overrides the image x offset specified when the image was loadedoffsetY
- overrides the image y offset specified when the image was loadedpublic void drawImageAxisX(javax.media.opengl.GL2 gl, Object id, Axis1D axis, double positionX, double positionY)
#drawImageAxisX( GL, Object, Axis1D, float, float, float, float, int, int )
public void drawImageAxisX(javax.media.opengl.GL2 gl, Object id, Axis1D axis, double positionX, double positionY, double scaleX, double scaleY, int centerX, int centerY)
GlimpseDataPainter1D
to paint onto a GlimpseAxisLayoutX
.gl
- handle from the current OpenGL contextid
- an icon loaded into the atlas using a loadImage() methodaxis
- the 1D horizontal axispositionX
- the x position along the axis of the image centerpositionY
- the y position in pixel space of the image centerscaleX
- the scale factor in the x directionscaleY
- the scale factor in the y directionoffsetX
- overrides the image x offset specified when the image was loadedoffsetY
- overrides the image y offset specified when the image was loadedpublic void drawImageAxisY(javax.media.opengl.GL2 gl, Object id, Axis1D axis, double positionX, double positionY)
GlimpseDataPainter1D
to paint onto a GlimpseAxisLayoutY
.#drawImageAxisX( GL, Object, Axis1D, float, float, float, float, int, int )
public void drawImageAxisY(javax.media.opengl.GL2 gl, Object id, Axis1D axis, double positionX, double positionY, double scaleX, double scaleY, int centerX, int centerY)
#drawImageAxisX( GL, Object, Axis1D, float, float, float, float, int, int )
public void drawImage(javax.media.opengl.GL2 gl, Object id, int positionX, int positionY, double scaleX, double scaleY, int centerX, int centerY)
public void drawImage(javax.media.opengl.GL2 gl, Object id, int positionX, int positionY, double scaleX, double scaleY)
public void drawImage(javax.media.opengl.GL2 gl, Object id, int positionX, int positionY)
public void beginRendering() throws javax.media.opengl.GLException
drawImage( GL, Object, Axis2D, float, float )
must be called while between calls to and {endRendering()}.javax.media.opengl.GLException
com.sun.opengl.util.j2d.TextRenderer#begin3DRendering( )
public void endRendering() throws javax.media.opengl.GLException
javax.media.opengl.GLException
com.sun.opengl.util.j2d.TextRenderer#end3DRendering( )
public void dispose() throws javax.media.opengl.GLException
javax.media.opengl.GLException
com.sun.opengl.util.j2d.TextRenderer#disposeAttached( )
Copyright © 2016 Metron, Inc.. All rights reserved.