net.ctdp.rfdynhud.render
Class TextureImage2D

java.lang.Object
  extended by net.ctdp.rfdynhud.render.TextureImage2D

public class TextureImage2D
extends java.lang.Object

This class provides a direct interface to draw on a Texture. Most of the code is borrowed from TextureImage2D from the Xith3D project. (http://xith.org/)

Author:
David Yazel, Marvin Froehlich (CTDP) (aka Qudus)

Nested Class Summary
static class TextureImage2D.TextDirection
           
 
Method Summary
<Rect2i_ extends Rect2i>
Rect2i_
clampToClipRect(Rect2i_ rect)
          Clamps the given rect to the current effective clip rect.
 void clear(boolean markDirty, Rect2i dirtyRect)
          Clears the whole (used part of the) texture with a black-transparent color.
 void clear(java.awt.Color color, boolean markDirty, Rect2i dirtyRect)
          Clears the whole (used part of the) texture with the specified color.
 void clear(java.awt.Color color, int offsetX, int offsetY, int width, int height, boolean markDirty, Rect2i dirtyRect)
          Clears the given rectangle with the specified color.
 void clear(int offsetX, int offsetY, int width, int height, boolean markDirty, Rect2i dirtyRect)
          Clears the given rectangle with a black-transparent color.
 void clear(TextureImage2D srcTI, boolean markDirty, Rect2i dirtyRect)
          Draws the given TextureImage2D onto this one and simply overwrites anything.
 void clear(TextureImage2D srcTI, int trgX, int trgY, boolean markDirty, Rect2i dirtyRect)
          Draws the given TextureImage2D onto this one and simply overwrites anything.
 void clear(TextureImage2D srcTI, int trgX, int trgY, int trgWidth, int trgHeight, boolean markDirty, Rect2i dirtyRect)
          Draws the given TextureImage2D onto this one and simply overwrites anything.
 void clear(TextureImage2D srcTI, int srcX, int srcY, int srcWidth, int srcHeight, int trgX, int trgY, boolean markDirty, Rect2i dirtyRect)
          Draws the given TextureImage2D onto this one and simply overwrites anything.
 void clear(TextureImage2D srcTI, int srcX, int srcY, int srcWidth, int srcHeight, int trgX, int trgY, int trgWidth, int trgHeight, boolean markDirty, Rect2i dirtyRect)
          Draws the given TextureImage2D onto this one and simply overwrites anything.
 void clear(TextureImage2D srcTI, Rect2i srcRect, int trgX, int trgY, boolean markDirty, Rect2i dirtyRect)
          Draws the given TextureImage2D onto this one and simply overwrites anything.
 void clearOutline(java.awt.Color color, int offsetX, int offsetY, int width, int height, int lineWidth, boolean markDirty, Rect2i dirtyRect)
          Clears the given rectangle's outline with the specified color.
 void clearPixelLine(byte[] pixels, int startX, int startY, int length, boolean markDirty, Rect2i dirtyRect)
          Clears a horizontal line of pixels.
 void copyImageDataFrom(java.awt.image.BufferedImage srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int trgX, int trgY, int trgWidth, int trgHeight, boolean overwrite, boolean markDirty, Rect2i dirtyRect)
           
static TextureImage2D createDrawTexture(int width, int height, boolean alpha)
           
static TextureImage2D createDrawTexture(int maxWidth, int maxHeight, int usedWidth, int usedHeight, boolean alpha)
           
protected  java.awt.Graphics2D createGraphics2D()
           
 void drawImage(TextureImage2D srcTI, int trgX, int trgY, boolean markDirty, Rect2i dirtyRect)
          Draws the given TextureImage2D onto this one and honors the alpha channels (if any).
 void drawImage(TextureImage2D srcTI, int srcX, int srcY, int srcWidth, int srcHeight, int trgX, int trgY, boolean markDirty, Rect2i dirtyRect)
          Draws the given TextureImage2D onto this one and honors the alpha channels (if any).
 void drawImage(TextureImage2D srcTI, int srcX, int srcY, int srcWidth, int srcHeight, int trgX, int trgY, int trgWidth, int trgHeight, boolean markDirty, Rect2i dirtyRect)
          Draws the given TextureImage2D onto this one and honors the alpha channels (if any).
 void drawImage(TextureImage2D srcTI, Rect2i srcRect, int trgX, int trgY, boolean markDirty, Rect2i dirtyRect)
          Draws the given TextureImage2D onto this one and honors the alpha channels (if any).
 void drawPixelLine(byte[] pixels, int startX, int startY, int length, boolean markDirty, Rect2i dirtyRect)
          Draws a horizontal line of pixels and combines alpha channels if necessary.
 void drawString(java.lang.String s, int x, int y, java.awt.geom.Rectangle2D bounds, java.awt.Font font, boolean antiAliased, java.awt.Color color, boolean markDirty, Rect2i dirtyRect)
          Draws a String at the specified location.
 void drawString(java.lang.String s, int x, int y, java.awt.geom.Rectangle2D bounds, java.awt.Font font, boolean antiAliased, java.awt.Color color, TextureImage2D.TextDirection direction, boolean markDirty, Rect2i dirtyRect)
          Draws a String at the specified location.
 void fillFullRectangle(java.awt.Color color, boolean markDirty, Rect2i dirtyRect)
          Fills the complete (used part of the) texture with the specified color and combines alpha channels if necessary.
 void fillRectangle(java.awt.Color color, int offsetX, int offsetY, int width, int height, boolean markDirty, Rect2i dirtyRect)
          Fills the given rectangle with the specified color and combines alpha channels if necessary.
 java.awt.image.BufferedImage getBufferedImage()
          Gets a BufferedImagebacked by this texture's data.
<Rect2i_ extends Rect2i>
Rect2i_
getClipRect(Rect2i_ rect)
          Gets the currently used clip-rect.
 byte[] getData()
          Gets the backing byte array.
static int getFontAscent(java.awt.Font font)
           
static int getFontDescent(java.awt.Font font)
           
 int getHeight()
          Gets the height-part of the texture, that is actually used by the application.
static int getLineHeight(java.awt.Font font, boolean antiAliased)
           
static int getLineHeight(FontProperty font)
           
 int getMaxHeight()
          Gets the physical height of the texture.
 int getMaxWidth()
          Gets the physical width of the texture.
 java.lang.String getName()
           
static TextureImage2D getOrCreateDrawTexture(int width, int height, boolean alpha, TextureImage2D possibleResult, boolean usePowerOfTwoSizes)
           
 byte[] getPixel(int x, int y, byte[] data)
          Gets one pixel.
 int getPixelBytes()
          Gets the number of bytes per pixel (3 or 4).
 byte[] getPixelLine(int x, int y, byte[] data, int length)
          Gets one (part of a) pixel line.
 int getPixelSize()
          Gets the number of bits per pixel (24 or 32).
static java.awt.geom.Rectangle2D getStringBounds(java.lang.String s, java.awt.Font font, boolean antiAliased)
           
static java.awt.geom.Rectangle2D getStringBounds(java.lang.String s, FontProperty font)
           
static int getStringHeight(java.lang.String s, java.awt.Font font, boolean antiAliased)
           
static int getStringHeight(java.lang.String s, FontProperty font)
           
static int getStringWidth(java.lang.String s, java.awt.Font font, boolean antiAliased)
           
static int getStringWidth(java.lang.String s, FontProperty font)
           
 Texture2DCanvas getTextureCanvas()
          Gets the attached Texture2DCanvas.
 int getWidth()
          Gets the width-part of the texture, that is actually used by the application.
 boolean hasAlphaChannel()
          Gets whether this texture has an alpha channel.
 boolean hasTextureCanvas()
          Gets whether this texture has an attached Texture2DCanvas instance.
protected  void markDirty(int x, int y, int width, int height, boolean clampClip, boolean validate, Rect2i dirtyRect)
           
<Rect2i_ extends Rect2i>
Rect2i_
markDirty(int x, int y, int width, int height, Rect2i_ dirtyRect)
          Marks a portion of the image component as dirty.
<Rect2i_ extends Rect2i>
Rect2i_
markDirty(Rect2i r, Rect2i_ dirtyRect)
          Marks a portion of the image component as dirty.
 void resize(int width, int height)
          Resizes this texture to a size in range [1,getMaxWidth()],[1,getMaxHeight()].
 void setClipRect(int x, int y, int width, int height)
          Sets the clip-rect, that will be clipping the drawn pixels.
 void setClipRect(Rect2i clipRect)
          Sets the clip-rect, that will be clipping the drawn pixels.
 void setName(java.lang.String name)
           
protected  void setPixel(int offset, byte[] data)
           
 void setPixel(int x, int y, byte[] data, boolean markDirty, Rect2i dirtyRect)
          Sets one pixel.
 void setPixelLine(int x, int y, int length, byte[] data, int srcOffset, boolean markDirty, Rect2i dirtyRect)
          Sets one (part of a) pixel line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setName

public void setName(java.lang.String name)

getName

public final java.lang.String getName()

getMaxWidth

public final int getMaxWidth()
Gets the physical width of the texture.

Returns:
the physical width of the texture.

getMaxHeight

public final int getMaxHeight()
Gets the physical height of the texture.

Returns:
the physical height of the texture.

getWidth

public final int getWidth()
Gets the width-part of the texture, that is actually used by the application. Since textures always need to be power-of-two-sized, the physical size can be larger than the used part. If we need a texture of width 800, the physical width of this texture will be 1024.

Returns:
the used part of the texture width.

getHeight

public final int getHeight()
Gets the height-part of the texture, that is actually used by the application. Since textures always need to be power-of-two-sized, the physical size can be larger than the used part. If we need a texture of height 600, the physical height of this texture will be 1024.

Returns:
the used part of the texture height.

resize

public void resize(int width,
                   int height)
Resizes this texture to a size in range [1,getMaxWidth()],[1,getMaxHeight()].

Parameters:
width - the width to resize to
height - the height to resize to

getPixelBytes

public final int getPixelBytes()
Gets the number of bytes per pixel (3 or 4).

Returns:
the number of bytes per pixel.

getPixelSize

public final int getPixelSize()
Gets the number of bits per pixel (24 or 32).

Returns:
the number of bits per pixel.

hasAlphaChannel

public final boolean hasAlphaChannel()
Gets whether this texture has an alpha channel.

Returns:
whether this texture has an alpha channel.

getData

public final byte[] getData()
Gets the backing byte array.

Returns:
null, if this texture is backed by a ByteBuffer.

hasTextureCanvas

public final boolean hasTextureCanvas()
Gets whether this texture has an attached Texture2DCanvas instance.

Returns:
whether this texture has an attached Texture2DCanvas instance.

getTextureCanvas

public Texture2DCanvas getTextureCanvas()
Gets the attached Texture2DCanvas. If it doesn't currently have one, it will be created.

Returns:
the attached Texture2DCanvas. (never null)

markDirty

protected void markDirty(int x,
                         int y,
                         int width,
                         int height,
                         boolean clampClip,
                         boolean validate,
                         Rect2i dirtyRect)

markDirty

public final <Rect2i_ extends Rect2i> Rect2i_ markDirty(int x,
                                                        int y,
                                                        int width,
                                                        int height,
                                                        Rect2i_ dirtyRect)
Marks a portion of the image component as dirty. The region will be pushed to the graphics card on the next frame.

Type Parameters:
Rect2i_ - parameter type restriction
Parameters:
x - the left coordinate
y - the top coordinate
width - the width
height - the height
dirtyRect - the dirtyRect to fill, if non null
Returns:
the 'dirtyRect' back again.

markDirty

public final <Rect2i_ extends Rect2i> Rect2i_ markDirty(Rect2i r,
                                                        Rect2i_ dirtyRect)
Marks a portion of the image component as dirty. The region will be pushed to the graphics card on the next frame.

Type Parameters:
Rect2i_ - parameter type restriction
Parameters:
r - the rectangle
dirtyRect - the dirtyRect to fill, if non null
Returns:
the 'dirtyRect' back again.

getBufferedImage

public java.awt.image.BufferedImage getBufferedImage()
Gets a BufferedImagebacked by this texture's data.

Returns:
a BufferedImagebacked by this texture's data.

createGraphics2D

protected java.awt.Graphics2D createGraphics2D()

setClipRect

public void setClipRect(int x,
                        int y,
                        int width,
                        int height)
Sets the clip-rect, that will be clipping the drawn pixels.

Parameters:
x - the left coordinate
y - the top coordinate
width - the width
height - the height

setClipRect

public final void setClipRect(Rect2i clipRect)
Sets the clip-rect, that will be clipping the drawn pixels.

Parameters:
clipRect - the clip rectangle

getClipRect

public final <Rect2i_ extends Rect2i> Rect2i_ getClipRect(Rect2i_ rect)
Gets the currently used clip-rect.

Type Parameters:
Rect2i_ - the return and parameter type restriction
Parameters:
rect - where the rectangle data will be written to.
Returns:
the passed-in rectangle back again.

clampToClipRect

public final <Rect2i_ extends Rect2i> Rect2i_ clampToClipRect(Rect2i_ rect)
Clamps the given rect to the current effective clip rect.

Type Parameters:
Rect2i_ - the return and parameter type restriction
Parameters:
rect - the rectangle
Returns:
the passed-in rectangle back again.

setPixel

protected final void setPixel(int offset,
                              byte[] data)

setPixel

public final void setPixel(int x,
                           int y,
                           byte[] data,
                           boolean markDirty,
                           Rect2i dirtyRect)
Sets one pixel.

Parameters:
x - the x-coordinate
y - the y-coordinate
data - the source pixel data
markDirty - if true, the pixel is marked dirty
dirtyRect - if non null, the dirty rect is written to this instance

getPixel

public final byte[] getPixel(int x,
                             int y,
                             byte[] data)
Gets one pixel.

Parameters:
x - the x-coordinate
y - the y-coordinate
data - the target pixel data
Returns:
the pixel data back again.

setPixelLine

public final void setPixelLine(int x,
                               int y,
                               int length,
                               byte[] data,
                               int srcOffset,
                               boolean markDirty,
                               Rect2i dirtyRect)
Sets one (part of a) pixel line.

Parameters:
x - the x-cordinate of the starting location
y - the y-cordinate of the starting location
length - the number of pixels to write
data - the source pixel data
srcOffset - the offset in the source array
markDirty - if true, the pixel is marked dirty
dirtyRect - if non null, the dirty rect is written to this instance

getPixelLine

public final byte[] getPixelLine(int x,
                                 int y,
                                 byte[] data,
                                 int length)
Gets one (part of a) pixel line.

Parameters:
x - the x-cordinate of the starting location
y - the y-cordinate of the starting location
data - the target pixel data
length - the number of pixels to read
Returns:
the pixel data

copyImageDataFrom

public void copyImageDataFrom(java.awt.image.BufferedImage srcImage,
                              int srcX,
                              int srcY,
                              int srcWidth,
                              int srcHeight,
                              int trgX,
                              int trgY,
                              int trgWidth,
                              int trgHeight,
                              boolean overwrite,
                              boolean markDirty,
                              Rect2i dirtyRect)

drawImage

public final void drawImage(TextureImage2D srcTI,
                            int srcX,
                            int srcY,
                            int srcWidth,
                            int srcHeight,
                            int trgX,
                            int trgY,
                            int trgWidth,
                            int trgHeight,
                            boolean markDirty,
                            Rect2i dirtyRect)
Draws the given TextureImage2D onto this one and honors the alpha channels (if any).

Parameters:
srcTI - source image
srcX - the rectangle's left to copy from the source TextureImage2D.
srcY - the rectangle's top to copy from the source TextureImage2D.
srcWidth - the rectangle's width to copy from the source TextureImage2D.
srcHeight - the rectangle's height to copy from the source TextureImage2D.
trgX - target x-coordinate
trgY - target y-coordinate
trgWidth - the targetWidth (tiled or clipped if necessary)
trgHeight - the targetHeight (tiled or clipped if necessary)
markDirty - if true, the pixel is marked dirty
dirtyRect - if non null, the dirty rect is written to this instance

drawImage

public final void drawImage(TextureImage2D srcTI,
                            int srcX,
                            int srcY,
                            int srcWidth,
                            int srcHeight,
                            int trgX,
                            int trgY,
                            boolean markDirty,
                            Rect2i dirtyRect)
Draws the given TextureImage2D onto this one and honors the alpha channels (if any).

Parameters:
srcTI - source image
srcX - the rectangle's left to copy from the source TextureImage2D.
srcY - the rectangle's top to copy from the source TextureImage2D.
srcWidth - the rectangle's width to copy from the source TextureImage2D.
srcHeight - the rectangle's height to copy from the source TextureImage2D.
trgX - target x-coordinate
trgY - target y-coordinate
markDirty - if true, the pixel is marked dirty
dirtyRect - if non null, the dirty rect is written to this instance

drawImage

public final void drawImage(TextureImage2D srcTI,
                            Rect2i srcRect,
                            int trgX,
                            int trgY,
                            boolean markDirty,
                            Rect2i dirtyRect)
Draws the given TextureImage2D onto this one and honors the alpha channels (if any).

Parameters:
srcTI - source image
srcRect - the rectangle to copy from the source TextureImage2D.
trgX - target x-coordinate
trgY - target y-coordinate
markDirty - if true, the pixel is marked dirty
dirtyRect - if non null, the dirty rect is written to this instance

drawImage

public final void drawImage(TextureImage2D srcTI,
                            int trgX,
                            int trgY,
                            boolean markDirty,
                            Rect2i dirtyRect)
Draws the given TextureImage2D onto this one and honors the alpha channels (if any).

Parameters:
srcTI - source image
trgX - target x-coordinate
trgY - target y-coordinate
markDirty - if true, the pixel is marked dirty
dirtyRect - if non null, the dirty rect is written to this instance

fillRectangle

public void fillRectangle(java.awt.Color color,
                          int offsetX,
                          int offsetY,
                          int width,
                          int height,
                          boolean markDirty,
                          Rect2i dirtyRect)
Fills the given rectangle with the specified color and combines alpha channels if necessary.

Parameters:
color - the color to fill with
offsetX - the destination x coordinate
offsetY - the destination y coordinate
width - the destination area width
height - the destination area height
markDirty - if true, the pixel is marked dirty
dirtyRect - if non null, the dirty rect is written to this instance

fillFullRectangle

public final void fillFullRectangle(java.awt.Color color,
                                    boolean markDirty,
                                    Rect2i dirtyRect)
Fills the complete (used part of the) texture with the specified color and combines alpha channels if necessary.

Parameters:
color - the color to fill with
markDirty - if true, the pixel is marked dirty
dirtyRect - if non null, the dirty rect is written to this instance

drawPixelLine

public void drawPixelLine(byte[] pixels,
                          int startX,
                          int startY,
                          int length,
                          boolean markDirty,
                          Rect2i dirtyRect)
Draws a horizontal line of pixels and combines alpha channels if necessary.

Parameters:
pixels - the pixel data array
startX - the x-coordinate of the starting location
startY - the y-coordinate of the starting location
length - the number of pixels to draw
markDirty - if true, the pixel is marked dirty
dirtyRect - if non null, the dirty rect is written to this instance

clear

public final void clear(TextureImage2D srcTI,
                        int srcX,
                        int srcY,
                        int srcWidth,
                        int srcHeight,
                        int trgX,
                        int trgY,
                        int trgWidth,
                        int trgHeight,
                        boolean markDirty,
                        Rect2i dirtyRect)
Draws the given TextureImage2D onto this one and simply overwrites anything.

Parameters:
srcTI - source image
srcX - the rectangle's left to copy from the source TextureImage2D.
srcY - the rectangle's top to copy from the source TextureImage2D.
srcWidth - the rectangle's width to copy from the source TextureImage2D.
srcHeight - the rectangle's height to copy from the source TextureImage2D.
trgX - target x-coordinate
trgY - target y-coordinate
trgWidth - the targetWidth (tiled or clipped if necessary)
trgHeight - the targetHeight (tiled or clipped if necessary)
markDirty - if true, the pixel is marked dirty
dirtyRect - if non null, the dirty rect is written to this instance

clear

public final void clear(TextureImage2D srcTI,
                        int trgX,
                        int trgY,
                        int trgWidth,
                        int trgHeight,
                        boolean markDirty,
                        Rect2i dirtyRect)
Draws the given TextureImage2D onto this one and simply overwrites anything.

Parameters:
srcTI - source image
trgX - target x-coordinate
trgY - target y-coordinate
trgWidth - the targetWidth (tiled or clipped if necessary)
trgHeight - the targetHeight (tiled or clipped if necessary)
markDirty - if true, the pixel is marked dirty
dirtyRect - if non null, the dirty rect is written to this instance

clear

public final void clear(TextureImage2D srcTI,
                        int srcX,
                        int srcY,
                        int srcWidth,
                        int srcHeight,
                        int trgX,
                        int trgY,
                        boolean markDirty,
                        Rect2i dirtyRect)
Draws the given TextureImage2D onto this one and simply overwrites anything.

Parameters:
srcTI - source image
srcX - the rectangle's left to copy from the source TextureImage2D.
srcY - the rectangle's top to copy from the source TextureImage2D.
srcWidth - the rectangle's width to copy from the source TextureImage2D.
srcHeight - the rectangle's height to copy from the source TextureImage2D.
trgX - target x-coordinate
trgY - target y-coordinate
markDirty - if true, the pixel is marked dirty
dirtyRect - if non null, the dirty rect is written to this instance

clear

public final void clear(TextureImage2D srcTI,
                        Rect2i srcRect,
                        int trgX,
                        int trgY,
                        boolean markDirty,
                        Rect2i dirtyRect)
Draws the given TextureImage2D onto this one and simply overwrites anything.

Parameters:
srcTI - source image
srcRect - the rectangle to copy from the source TextureImage2D.
trgX - target x-coordinate
trgY - target y-coordinate
markDirty - if true, the pixel is marked dirty
dirtyRect - if non null, the dirty rect is written to this instance

clear

public final void clear(TextureImage2D srcTI,
                        int trgX,
                        int trgY,
                        boolean markDirty,
                        Rect2i dirtyRect)
Draws the given TextureImage2D onto this one and simply overwrites anything.

Parameters:
srcTI - source image
trgX - target x-coordinate
trgY - target y-coordinate
markDirty - if true, the pixel is marked dirty
dirtyRect - if non null, the dirty rect is written to this instance

clear

public final void clear(TextureImage2D srcTI,
                        boolean markDirty,
                        Rect2i dirtyRect)
Draws the given TextureImage2D onto this one and simply overwrites anything.

Parameters:
srcTI - source image
markDirty - if true, the pixel is marked dirty
dirtyRect - if non null, the dirty rect is written to this instance

clearOutline

public void clearOutline(java.awt.Color color,
                         int offsetX,
                         int offsetY,
                         int width,
                         int height,
                         int lineWidth,
                         boolean markDirty,
                         Rect2i dirtyRect)
Clears the given rectangle's outline with the specified color.

Parameters:
color - the color to draw with
offsetX - the destination x coordinate
offsetY - the destination y coordinate
width - the destination area width
height - the destination area height
lineWidth - the width of the outline
markDirty - if true, the pixel is marked dirty
dirtyRect - if non null, the dirty rect is written to this instance

clear

public void clear(java.awt.Color color,
                  int offsetX,
                  int offsetY,
                  int width,
                  int height,
                  boolean markDirty,
                  Rect2i dirtyRect)
Clears the given rectangle with the specified color.

Parameters:
color - the color to clear with
offsetX - the destination x coordinate
offsetY - the destination y coordinate
width - the destination area width
height - the destination area height
markDirty - if true, the pixel is marked dirty
dirtyRect - if non null, the dirty rect is written to this instance

clear

public final void clear(java.awt.Color color,
                        boolean markDirty,
                        Rect2i dirtyRect)
Clears the whole (used part of the) texture with the specified color.

Parameters:
color - the color to clear with
markDirty - if true, the pixel is marked dirty
dirtyRect - if non null, the dirty rect is written to this instance

clear

public final void clear(int offsetX,
                        int offsetY,
                        int width,
                        int height,
                        boolean markDirty,
                        Rect2i dirtyRect)
Clears the given rectangle with a black-transparent color.

Parameters:
offsetX - the destination x coordinate
offsetY - the destination y coordinate
width - the destination area width
height - the destination area height
markDirty - if true, the pixel is marked dirty
dirtyRect - if non null, the dirty rect is written to this instance

clear

public final void clear(boolean markDirty,
                        Rect2i dirtyRect)
Clears the whole (used part of the) texture with a black-transparent color.

Parameters:
markDirty - if true, the pixel is marked dirty
dirtyRect - if non null, the dirty rect is written to this instance

clearPixelLine

public void clearPixelLine(byte[] pixels,
                           int startX,
                           int startY,
                           int length,
                           boolean markDirty,
                           Rect2i dirtyRect)
Clears a horizontal line of pixels.

Parameters:
pixels - the pixel data
startX - the x-coordinate of the starting location
startY - the y-coordinate of the starting location
length - the number of pixels to clear
markDirty - if true, the pixel is marked dirty
dirtyRect - if non null, the dirty rect is written to this instance

getStringBounds

public static final java.awt.geom.Rectangle2D getStringBounds(java.lang.String s,
                                                              java.awt.Font font,
                                                              boolean antiAliased)

getStringBounds

public static final java.awt.geom.Rectangle2D getStringBounds(java.lang.String s,
                                                              FontProperty font)

getStringWidth

public static final int getStringWidth(java.lang.String s,
                                       java.awt.Font font,
                                       boolean antiAliased)

getStringWidth

public static final int getStringWidth(java.lang.String s,
                                       FontProperty font)

getStringHeight

public static final int getStringHeight(java.lang.String s,
                                        java.awt.Font font,
                                        boolean antiAliased)

getStringHeight

public static final int getStringHeight(java.lang.String s,
                                        FontProperty font)

getLineHeight

public static final int getLineHeight(java.awt.Font font,
                                      boolean antiAliased)

getLineHeight

public static final int getLineHeight(FontProperty font)

getFontAscent

public static final int getFontAscent(java.awt.Font font)

getFontDescent

public static final int getFontDescent(java.awt.Font font)

drawString

public void drawString(java.lang.String s,
                       int x,
                       int y,
                       java.awt.geom.Rectangle2D bounds,
                       java.awt.Font font,
                       boolean antiAliased,
                       java.awt.Color color,
                       boolean markDirty,
                       Rect2i dirtyRect)
Draws a String at the specified location.

Parameters:
s - the String to draw
x - the x-position
y - the y-position of the String's baseline
bounds - the String's bounds. If null, bounds will be created temporarily
font - the Font to use
antiAliased - anti aliased font?
color - the Color to use
markDirty - if true, the pixel is marked dirty
dirtyRect - if non null, the dirty rect is written to this instance

drawString

public void drawString(java.lang.String s,
                       int x,
                       int y,
                       java.awt.geom.Rectangle2D bounds,
                       java.awt.Font font,
                       boolean antiAliased,
                       java.awt.Color color,
                       TextureImage2D.TextDirection direction,
                       boolean markDirty,
                       Rect2i dirtyRect)
Draws a String at the specified location.

Parameters:
s - the String to draw
x - the x-position
y - the y-position of the String's baseline
bounds - the String's bounds. If null, bounds will be created temporarily
font - the Font to use
antiAliased - anti aliased font?
color - the Color to use
direction - the text direction
markDirty - if true, the pixel is marked dirty
dirtyRect - if non null, the dirty rect is written to this instance

createDrawTexture

public static TextureImage2D createDrawTexture(int maxWidth,
                                               int maxHeight,
                                               int usedWidth,
                                               int usedHeight,
                                               boolean alpha)

createDrawTexture

public static TextureImage2D createDrawTexture(int width,
                                               int height,
                                               boolean alpha)

getOrCreateDrawTexture

public static TextureImage2D getOrCreateDrawTexture(int width,
                                                    int height,
                                                    boolean alpha,
                                                    TextureImage2D possibleResult,
                                                    boolean usePowerOfTwoSizes)