Jazz3D API


com.sygem.jazz3d3
Class Texture

java.lang.Object
  |
  +--com.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
Author:
SyGem Software

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.
 int getHeight()
          Allows you to get the height of the texture.
 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 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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VLARGE

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

LARGE

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

MEDIUM

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

SMALL

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

VSMALL

public static final int VSMALL
Field used to represent a 64x64 texture
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

getTextureArray

public final int[] getTextureArray()
Allows you to get the internal representation of the texture.
Returns:
The array of integers containing the texture information

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

getHeight

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

getWidth

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

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

getTransparentColour

public final int getTransparentColour()
Get the transparent index of this texture.
Returns:
The transparent colour

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

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

©2001 SyGem Software