com.brackeen.javagamebook.graphics3D.texture
Class Texture

java.lang.Object
  extended bycom.brackeen.javagamebook.graphics3D.texture.Texture
Direct Known Subclasses:
PowerOf2Texture, ShadedSurface, ShadedTexture

public abstract class Texture
extends java.lang.Object

The Texture class is an sabstract class that represents a 16-bit color texture.


Constructor Summary
Texture(int width, int height)
          Creates a new Texture with the specified width and height.
 
Method Summary
static int countbits(int n)
          Counts the number of "on" bits in an integer.
static Texture createTexture(java.awt.image.BufferedImage image)
          Creates an unshaded Texture from the specified image.
static Texture createTexture(java.awt.image.BufferedImage image, boolean shaded)
          Creates an Texture from the specified image.
static Texture createTexture(java.lang.String filename)
          Creates an unshaded Texture from the specified image file.
static Texture createTexture(java.lang.String filename, boolean shaded)
          Creates an Texture from the specified image file.
abstract  short getColor(int x, int y)
          Gets the 16-bit color of this Texture at the specified (x,y) location.
 int getHeight()
          Gets the height of this Texture.
 int getWidth()
          Gets the width of this Texture.
static boolean isPowerOfTwo(int n)
          Returns true if the specified number is a power of 2.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Texture

public Texture(int width,
               int height)
Creates a new Texture with the specified width and height.

Method Detail

getWidth

public int getWidth()
Gets the width of this Texture.


getHeight

public int getHeight()
Gets the height of this Texture.


getColor

public abstract short getColor(int x,
                               int y)
Gets the 16-bit color of this Texture at the specified (x,y) location.


createTexture

public static Texture createTexture(java.lang.String filename)
Creates an unshaded Texture from the specified image file.


createTexture

public static Texture createTexture(java.lang.String filename,
                                    boolean shaded)
Creates an Texture from the specified image file. If shaded is true, then a ShadedTexture is returned.


createTexture

public static Texture createTexture(java.awt.image.BufferedImage image)
Creates an unshaded Texture from the specified image.


createTexture

public static Texture createTexture(java.awt.image.BufferedImage image,
                                    boolean shaded)
Creates an Texture from the specified image. If shaded is true, then a ShadedTexture is returned.


isPowerOfTwo

public static boolean isPowerOfTwo(int n)
Returns true if the specified number is a power of 2.


countbits

public static int countbits(int n)
Counts the number of "on" bits in an integer.