sk.upjs.fontmapper
Class TexturePage

java.lang.Object
  extended by sk.upjs.fontmapper.TexturePage

 class TexturePage
extends java.lang.Object

Texture page class. Handles storage of multiple subtextures on a single larger texture, using user specified texture packer.


Field Summary
private  java.awt.Graphics2D graphics_
          Graphics2D used to draw textures on the page.
private  java.awt.image.BufferedImage image_
          Image containing the texture data.
private  TexturePacker packer_
          Texture packer used to place textures on the page.
(package private)  GlyphDataWriter writer_
          Used for glyph metadata output.
 
Constructor Summary
TexturePage(java.awt.Dimension size, int colorMode, TexturePacker packer, GlyphDataWriter writer)
          Constructs a texture page with specified dimensions, color format and passes texture packer to use.
 
Method Summary
protected  void finalize()
          Finalizer - clean up the graphics objects.
 java.awt.font.FontRenderContext fontRenderContext()
           
 int height()
           
 java.awt.image.BufferedImage image()
           
 java.awt.geom.Rectangle2D.Float insertTexture(java.awt.image.BufferedImage image)
          Insert a texture image to the page.
 int width()
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

image_

private java.awt.image.BufferedImage image_
Image containing the texture data.


graphics_

private java.awt.Graphics2D graphics_
Graphics2D used to draw textures on the page.


packer_

private TexturePacker packer_
Texture packer used to place textures on the page.


writer_

GlyphDataWriter writer_
Used for glyph metadata output.

Constructor Detail

TexturePage

public TexturePage(java.awt.Dimension size,
                   int colorMode,
                   TexturePacker packer,
                   GlyphDataWriter writer)
Constructs a texture page with specified dimensions, color format and passes texture packer to use.

Parameters:
size - Size of the page.
colorMode - Color format of the pixels of the page.
packer - Texture packer to use to place textures on the page.
writer - GlyphDataWriter used to write glyyph metadata output.
Method Detail

insertTexture

public java.awt.geom.Rectangle2D.Float insertTexture(java.awt.image.BufferedImage image)
                                              throws TextureAllocationException,
                                                     TexturePageFullException
Insert a texture image to the page.

Parameters:
image - Image to insert.
Returns:
Rectangle specifying texcoords of the texture on the page.
Throws:
TexturePageFullException - if not enough space left to insert the texture.
TextureAllocationException - if the texture is too large to fit to the page.

width

public int width()
Returns:
width of the page.

height

public int height()
Returns:
height of the page.

image

public java.awt.image.BufferedImage image()
Returns:
image cotaining the texture data.

fontRenderContext

public java.awt.font.FontRenderContext fontRenderContext()
Returns:
ont renderer context for font drawing on the texture.

finalize

protected void finalize()
Finalizer - clean up the graphics objects.

Overrides:
finalize in class java.lang.Object