org.xith3d.loaders.texture
Class TextureCreator

java.lang.Object
  extended by org.xith3d.loaders.texture.TextureCreator

public class TextureCreator
extends java.lang.Object

The TextureCreator is capable of creating (empty) Textures.


Nested Class Summary
static class TextureCreator.TextMetrics
           
 
Field Summary
static int TEXT_ALIGNMENT_HORIZONTAL_CENTER
           
static int TEXT_ALIGNMENT_HORIZONTAL_LEFT
           
static int TEXT_ALIGNMENT_HORIZONTAL_RIGHT
           
 
Constructor Summary
TextureCreator()
           
 
Method Summary
static Texture2D createTexture(java.awt.image.BufferedImage img, Texture.MipmapMode mipmapMode)
          Creates a Texture from the given BufferedImage.
static Texture2D createTexture(java.awt.image.BufferedImage img, Texture.MipmapMode mipmapMode, int width, int height)
          Creates a Texture from the given BufferedImage.
static Texture2D createTexture(java.awt.image.BufferedImage img, org.jagatoo.opengl.enums.TextureFormat format, Texture.MipmapMode mipmapMode)
          Creates a Texture from the given BufferedImage.
static Texture2D createTexture(java.awt.image.BufferedImage img, org.jagatoo.opengl.enums.TextureFormat format, Texture.MipmapMode mipmapMode, int width, int height)
          Creates a Texture from the given BufferedImage.
static Texture2D createTexture(java.awt.image.BufferedImage img, TextureLoader.FlipMode flipVertically, Texture.MipmapMode mipmapMode)
          Creates a Texture from the given BufferedImage.
static Texture2D createTexture(java.awt.image.BufferedImage img, TextureLoader.FlipMode flipVertically, Texture.MipmapMode mipmapMode, int width, int height)
          Creates a Texture from the given BufferedImage.
static Texture2D createTexture(java.awt.image.BufferedImage img, TextureLoader.FlipMode flipVertically, org.jagatoo.opengl.enums.TextureFormat format, Texture.MipmapMode mipmapMode)
          Creates a Texture from the given BufferedImage.
static Texture2D createTexture(java.awt.image.BufferedImage img, TextureLoader.FlipMode flipVertically, org.jagatoo.opengl.enums.TextureFormat format, Texture.MipmapMode mipmapMode, boolean allowStreching)
          Creates a Texture from the given BufferedImage.
static Texture2D createTexture(java.awt.image.BufferedImage img, TextureLoader.FlipMode flipVertically, org.jagatoo.opengl.enums.TextureFormat format, Texture.MipmapMode mipmapMode, int width, int height)
          Creates a Texture from the given BufferedImage.
static Texture2D createTexture(java.awt.image.BufferedImage img, TextureLoader.FlipMode flipVertically, org.jagatoo.opengl.enums.TextureFormat format, Texture.MipmapMode mipmapMode, int width, int height, Texture2D tex)
          Creates a Texture from the given BufferedImage.
static Texture2D createTexture(java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font, int horizontalAlignment)
          Creates a new transparent Texture with a String drawn on it.
static Texture2D createTexture(java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font, int horizontalAlignment, boolean paddSizetoPower2)
          Creates a new transparent Texture with a String drawn on it.
static Texture2D createTexture(org.jagatoo.opengl.enums.TextureFormat format, int width, int height)
          Creates a new Texture2D with the given color.
static Texture2D createTexture(org.jagatoo.opengl.enums.TextureFormat format, int width, int height, org.openmali.vecmath2.Colorf color)
          Creates a new Texture2D with the given color.
static TextureCreator getInstance()
          Deprecated. this class has static method only now!
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEXT_ALIGNMENT_HORIZONTAL_LEFT

public static final int TEXT_ALIGNMENT_HORIZONTAL_LEFT
See Also:
Constant Field Values

TEXT_ALIGNMENT_HORIZONTAL_CENTER

public static final int TEXT_ALIGNMENT_HORIZONTAL_CENTER
See Also:
Constant Field Values

TEXT_ALIGNMENT_HORIZONTAL_RIGHT

public static final int TEXT_ALIGNMENT_HORIZONTAL_RIGHT
See Also:
Constant Field Values
Constructor Detail

TextureCreator

public TextureCreator()
Method Detail

getInstance

@Deprecated
public static TextureCreator getInstance()
Deprecated. this class has static method only now!

Returns:
the singleton instance of TextureCreator

createTexture

public static Texture2D createTexture(java.awt.image.BufferedImage img,
                                      TextureLoader.FlipMode flipVertically,
                                      org.jagatoo.opengl.enums.TextureFormat format,
                                      Texture.MipmapMode mipmapMode,
                                      int width,
                                      int height,
                                      Texture2D tex)
Creates a Texture from the given BufferedImage. The generated Texture is not cached.

Parameters:
img - The BufferedImage which should be converted.
format - The desired Texture format.
mipmapMode - Should the texture contain mipmaps ?
width - The desired texture width.
height - The desired texture height.
Returns:
Texture A Texture object that is based on the current content of the given image (NOT byRef!)

createTexture

public static Texture2D createTexture(java.awt.image.BufferedImage img,
                                      TextureLoader.FlipMode flipVertically,
                                      org.jagatoo.opengl.enums.TextureFormat format,
                                      Texture.MipmapMode mipmapMode,
                                      int width,
                                      int height)
Creates a Texture from the given BufferedImage. The generated Texture is not cached.

Parameters:
img - The BufferedImage which should be converted.
format - The desired Texture format.
mipmapMode - Should the texture contain mipmaps ?
width - The desired texture width.
height - The desired texture height.
Returns:
Texture A Texture object that is based on the current content of the given image (NOT byRef!)

createTexture

public static Texture2D createTexture(java.awt.image.BufferedImage img,
                                      TextureLoader.FlipMode flipVertically,
                                      org.jagatoo.opengl.enums.TextureFormat format,
                                      Texture.MipmapMode mipmapMode,
                                      boolean allowStreching)
Creates a Texture from the given BufferedImage. The generated Texture is not cached.

Parameters:
img - The BufferedImage which should be converted.
flipVertically - flip the image vertically or not
format - The desired Texture format.
mipmapMode - Should the texture contain mipmaps ?
allowStreching -
Returns:
Texture A Texture object that is based on the current content of the given image (NOT byRef!)

createTexture

public static Texture2D createTexture(java.awt.image.BufferedImage img,
                                      TextureLoader.FlipMode flipVertically,
                                      org.jagatoo.opengl.enums.TextureFormat format,
                                      Texture.MipmapMode mipmapMode)
Creates a Texture from the given BufferedImage. The generated Texture is not cached.

Parameters:
img - The BufferedImage which should be converted.
flipVertically - flip the image vertically or not
format - The desired Texture format.
mipmapMode - Should the texture contain mipmaps ?
Returns:
Texture A Texture object that is based on the current content of the given image (NOT byRef!)

createTexture

public static Texture2D createTexture(java.awt.image.BufferedImage img,
                                      org.jagatoo.opengl.enums.TextureFormat format,
                                      Texture.MipmapMode mipmapMode)
Creates a Texture from the given BufferedImage. The generated Texture is not cached.

Parameters:
img - The BufferedImage which should be converted.
format - The desired Texture format.
mipmapMode - Should the texture contain mipmaps ?
Returns:
Texture A Texture object that is based on the current content of the given image (NOT byRef!)

createTexture

public static Texture2D createTexture(java.awt.image.BufferedImage img,
                                      TextureLoader.FlipMode flipVertically,
                                      Texture.MipmapMode mipmapMode)
Creates a Texture from the given BufferedImage. The generated Texture is not cached.

Parameters:
img - The BufferedImage which should be converted.
flipVertically - flip the image vertically or not
mipmapMode - Should the texture contain mipmaps ?
Returns:
Texture A Texture object that is based on the current content of the given image (NOT byRef!)

createTexture

public static Texture2D createTexture(java.awt.image.BufferedImage img,
                                      Texture.MipmapMode mipmapMode)
Creates a Texture from the given BufferedImage. The generated Texture is not cached.

Parameters:
img - The BufferedImage which should be converted.
mipmapMode - Should the texture contain mipmaps ?
Returns:
Texture A Texture object that is based on the current content of the given image (NOT byRef!)

createTexture

public static Texture2D createTexture(java.awt.image.BufferedImage img,
                                      org.jagatoo.opengl.enums.TextureFormat format,
                                      Texture.MipmapMode mipmapMode,
                                      int width,
                                      int height)
Creates a Texture from the given BufferedImage. The generated Texture is not cached.

Parameters:
img - The BufferedImage which should be converted.
format - The desired Texture format.
mipmapMode - Should the texture contain mipmaps ?
width - The desired texture width.
height - The desired texture height.
Returns:
Texture A Texture object that is based on the current content of the given image (NOT byRef!)

createTexture

public static Texture2D createTexture(java.awt.image.BufferedImage img,
                                      TextureLoader.FlipMode flipVertically,
                                      Texture.MipmapMode mipmapMode,
                                      int width,
                                      int height)
Creates a Texture from the given BufferedImage. The generated Texture is not cached.

Parameters:
img - The BufferedImage which should be converted.
flipVertically - flip the image vertically or not
mipmapMode - Should the texture contain mipmaps ?
width - The desired texture width.
height - The desired texture height.
Returns:
Texture A Texture object that is based on the current content of the given image (NOT byRef!)

createTexture

public static Texture2D createTexture(java.awt.image.BufferedImage img,
                                      Texture.MipmapMode mipmapMode,
                                      int width,
                                      int height)
Creates a Texture from the given BufferedImage. The generated Texture is not cached.

Parameters:
img - The BufferedImage which should be converted.
mipmapMode - Should the texture contain mipmaps ?
width - The desired texture width.
height - The desired texture height.
Returns:
Texture A Texture object that is based on the current content of the given image (NOT byRef!)

createTexture

public static Texture2D createTexture(org.jagatoo.opengl.enums.TextureFormat format,
                                      int width,
                                      int height,
                                      org.openmali.vecmath2.Colorf color)
Creates a new Texture2D with the given color.

Parameters:
format -
width -
height -
color -
Returns:
the new Texture2D

createTexture

public static Texture2D createTexture(org.jagatoo.opengl.enums.TextureFormat format,
                                      int width,
                                      int height)
Creates a new Texture2D with the given color.

Parameters:
format -
width -
height -
Returns:
the new Texture2D

createTexture

public static Texture2D createTexture(java.lang.String text,
                                      org.openmali.vecmath2.Colorf color,
                                      java.awt.Font font,
                                      int horizontalAlignment,
                                      boolean paddSizetoPower2)
Creates a new transparent Texture with a String drawn on it.
Call texture.getUserData( "EFFECTIVE_SIZE" ) to retrieve the effective size when padded.

Parameters:
text - the text to draw on the Texture (inline '\n' for line wrapping).
color - text color (null for transparent)
font - the font to use
horizontalAlignment - horizontal alignment indicator
paddSizetoPower2 - if true, the Texture's size is padded up to the next power of 2 to avoid resizings
Returns:
returns a Texture (should be casted to Character)
See Also:
TEXT_ALIGNMENT_HORIZONTAL_LEFT, TEXT_ALIGNMENT_HORIZONTAL_CENTER, TEXT_ALIGNMENT_HORIZONTAL_RIGHT

createTexture

public static Texture2D createTexture(java.lang.String text,
                                      org.openmali.vecmath2.Colorf color,
                                      java.awt.Font font,
                                      int horizontalAlignment)
Creates a new transparent Texture with a String drawn on it. The Texture's size is padded up to the next power of 2 to avoid resizings.
Call texture.getUserData( "EFFECTIVE_SIZE" ) to retrieve the effective size.

Parameters:
text - the text to draw on the Texture (inline '\n' for line wrapping).
color - text color (null for transparent)
font - the font to use
horizontalAlignment - horizontal alignment indicator
Returns:
returns a Texture (should be casted to Character)
See Also:
TEXT_ALIGNMENT_HORIZONTAL_LEFT, TEXT_ALIGNMENT_HORIZONTAL_CENTER, TEXT_ALIGNMENT_HORIZONTAL_RIGHT