com.sygem.jazz3d3
Class Texture

java.lang.Object
  extended bycom.sygem.jazz3d3.Texture

public class Texture
extends java.lang.Object

A utility class designed to hold an image for use in Jazz3D. Internally, the image is held as an array of integers.

Version:
3.0a

Field Summary
static int LARGE
          Field used to represent a 512x512 texture
static int MEDIUM
          Field used to represent a 256x256 texture
static int SMALL
          Field used to represent a 128x128 texture
static int VLARGE
          Field used to represent a 1024x1024 texture
static int VSMALL
          Field used to represent a 64x64 texture
 
Constructor Summary
Texture()
          Default constructor.
Texture(int size)
          Construct a Texture of a specified size.
Texture(int sizex, int sizey)
          Construct a Texture of a specified size.
 
Method Summary
 void addTextureLayer(Texture tex)
          Add another texture on top of this one.
 void dispose()
           
 int getHeight()
          Allows you to get the height of the texture.
 int getPixel(int x, int y)
           
 int[] getTextureArray()
          Allows you to get the internal representation of the texture.
 int getTransparentColour()
          Get the transparent index of this texture.
 int getWidth()
          Allows you to get the width of the texture.
 void mixTextureLayer(Texture tex, double d)
          Mix this texture together with another.
 void read(java.io.FileInputStream reader)
           
 void setPixel(int x, int y, int pix)
           
 void setTextureArray(int[] values)
          Sets the texture array to a new set of values.
 void setTransparentColour(int tCol)
          Set the transparent index of this texture.
 void setTransparentColour(int r, int g, int b)
          Set the transparent index of this texture.
 void write(java.io.FileOutputStream writer)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LARGE

public static final int LARGE
Field used to represent a 512x512 texture

See Also:
Constant Field Values

MEDIUM

public static final int MEDIUM
Field used to represent a 256x256 texture

See Also:
Constant Field Values

SMALL

public static final int SMALL
Field used to represent a 128x128 texture

See Also:
Constant Field Values

VLARGE

public static final int VLARGE
Field used to represent a 1024x1024 texture

See Also:
Constant Field Values

VSMALL

public static final int VSMALL
Field used to represent a 64x64 texture

See Also:
Constant Field Values
Constructor Detail

Texture

public Texture()
Default constructor. Textures are MEDIUM by default.

See Also:
Texture(int)

Texture

public Texture(int size)
Construct a Texture of a specified size. Textures are MEDIUM by default.

See Also:
Texture()

Texture

public Texture(int sizex,
               int sizey)
Construct a Texture of a specified size. Textures are MEDIUM by default.

See Also:
Texture()
Method Detail

addTextureLayer

public final void addTextureLayer(Texture tex)
Add another texture on top of this one. The addition is done based on the new texture's transparent colour. NOTE: The textures must be the same size!

Parameters:
tex - A Texture

dispose

public void dispose()

getHeight

public final int getHeight()
Allows you to get the height of the texture.

Returns:
The height of the texture

getPixel

public int getPixel(int x,
                    int y)

getTextureArray

public final int[] getTextureArray()
Allows you to get the internal representation of the texture.

Returns:
The array of integers containing the texture information

getTransparentColour

public final int getTransparentColour()
Get the transparent index of this texture.

Returns:
The transparent colour

getWidth

public final int getWidth()
Allows you to get the width of the texture.

Returns:
The width of the texture

mixTextureLayer

public final void mixTextureLayer(Texture tex,
                                  double d)
Mix this texture together with another. The mixing is done based on the new texture's transparent colour, and the parameter 'd' - the bigger the value of 'd', the more new texture is mixed. NOTE: The textures must be the same size!

Parameters:
tex - A Texture
d - Value between 0 & 1 - the mix amount

read

public void read(java.io.FileInputStream reader)
          throws java.io.IOException
Throws:
java.io.IOException

setPixel

public void setPixel(int x,
                     int y,
                     int pix)

setTextureArray

public final void setTextureArray(int[] values)
Sets the texture array to a new set of values. Can be used to enable dynamic altering of textures.

Parameters:
values - An array of ints representing an image

setTransparentColour

public final void setTransparentColour(int tCol)
Set the transparent index of this texture.

Parameters:
tCol - The transparent colour

setTransparentColour

public final void setTransparentColour(int r,
                                       int g,
                                       int b)
Set the transparent index of this texture.

Parameters:
r - The red component of the colour
g - The green component of the colour
b - The blue component of the colour

write

public void write(java.io.FileOutputStream writer)
           throws java.io.IOException
Throws:
java.io.IOException


Copyright © 1999-2006 SyGem Software. All Rights Reserved.