org.proteinshader.graphics.typography
Class TextLabel

java.lang.Object
  extended by org.proteinshader.graphics.typography.TextLabel

public class TextLabel
extends Object

Stores a byte buffer with the bitmap for a text label that can be applied to the curved surface of a 3D tube or ribbon.

The bitmap will be WIDTH x HEIGHT pixels and is intended to hold a text label of a few to several characters such as 'A 234' or 'G 37' (for alanine at position 234 or glycine at position 37). The bytes will later be copied into the midde of an existing OpenGL texture object by using glTexSubImage2D(). The texture map will then be used to paste labels onto curved surfaces.


Field Summary
static int HEIGHT
          The height is 32 pixels.
static int WIDTH
          The width is 128 pixels.
 
Constructor Summary
TextLabel(String name, int format, int dataType, int width, int height, int bytesPerPixel, ByteBuffer image)
          Constructs a TextLabel.
 
Method Summary
 int getBytesPerPixel()
          Returns the number of bytes per pixel.
 int getDataType()
          Returns the OpenGL data type (such as GL_UNSIGNED_BYTE).
 int getFormat()
          Returns the number of bytes per pixel.
 int getHeight()
          Returns the height of the glyph in pixels.
 ByteBuffer getImage()
          Returns the buffer with the text image in it.
 String getName()
          Returns the name of the glyph.
 int getWidth()
          Returns the width of the glyph in pixels.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WIDTH

public static final int WIDTH
The width is 128 pixels.

See Also:
Constant Field Values

HEIGHT

public static final int HEIGHT
The height is 32 pixels.

See Also:
Constant Field Values
Constructor Detail

TextLabel

public TextLabel(String name,
                 int format,
                 int dataType,
                 int width,
                 int height,
                 int bytesPerPixel,
                 ByteBuffer image)
Constructs a TextLabel.

The image is a bitmap that was created from copying bytes out of Glyph objects.

Parameters:
name - the text string the label corresponds to.
format - the number of bytes per pixel.
dataType - an OpenGL data type such as GL_UNSIGNED_BYTE.
width - the width of the bitmap in pixels.
height - the height of the bitmap in pixels.
image - a byte buffer created by combining glyphs.
bytesPerPixel - the number of byte per pixel.
Method Detail

getImage

public ByteBuffer getImage()
Returns the buffer with the text image in it.

Returns:
The buffer with the text image in it.

getName

public String getName()
Returns the name of the glyph. The name is usually only one character, but a glyph can sometimes represent two or more characters.

Returns:
The name as a String.

getFormat

public int getFormat()
Returns the number of bytes per pixel.

Returns:
The number of bytes per pixel.

getDataType

public int getDataType()
Returns the OpenGL data type (such as GL_UNSIGNED_BYTE).

Returns:
The data type.

getWidth

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

Returns:
The width in pixels.

getHeight

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

Returns:
The height in pixels.

getBytesPerPixel

public int getBytesPerPixel()
Returns the number of bytes per pixel.

Returns:
The number of bytes per pixel.


Copyright © 2007-2008