zombie.interfaces
Interface ITexture

All Superinterfaces:
IDestroyable, IMaskerable
All Known Implementing Classes:
Texture

public interface ITexture
extends IDestroyable, IMaskerable

Author:
LEMMY

Method Summary
 void bind()
          bind the current texture in the VRAM
 void bind(int unit)
          bind the current texture object in the specified texture unit
 WrappedBuffer getData()
          returns the texture's pixel in a ByteBuffer EXAMPLE:
ByteBuffer bb = getData();
byte r, g, b;
bb.rewind(); //<-- IMPORTANT!!
try {
while (true) {
bb.mark();
r = bb.get();
g = bb.get();
b = bb.get();
bb.reset();
bb.put((byte)(r+red));
bb.put((byte)(g+green));
bb.put((byte)(b+blue));
bb.get(); // alpha
}
} catch (Exception e) {
}
setData(bb);
 int getHeight()
          returns the height of image
 int getHeightHW()
          return the height hardware of image
 int getID()
          returns the ID of image in the Vram
 int getWidth()
          returns the width of image
 int getWidthHW()
          return the width Hardware of image
 float getXEnd()
          returns the end X-coordinate
 float getXStart()
          returns the start X-coordinate
 float getYEnd()
          returns the end Y-coordinate
 float getYStart()
          returns the start Y-coordinate
 boolean isSolid()
          indicates if the texture is solid or not.
a non solid texture is a texture that containe an alpha channel
 void makeTransp(int red, int green, int blue)
          sets transparent each pixel that it's equal to the red, green blue value specified
 void setAlphaForeach(int red, int green, int blue, int alpha)
          sets the specified alpha for each pixel that it's equal to the red, green blue value specified
 void setData(java.nio.ByteBuffer data)
          sets the texture's pixel from a ByteBuffer EXAMPLE:
ByteBuffer bb = getData();
byte r, g, b;
bb.rewind(); //<-- IMPORTANT!!
try {
while (true) {
bb.mark();
r = bb.get();
g = bb.get();
b = bb.get();
bb.reset();
bb.put((byte)(r+red));
bb.put((byte)(g+green));
bb.put((byte)(b+blue));
bb.get(); // alpha
}
} catch (Exception e) {
}
setData(bb);
 void setMask(Mask mask)
          Pixel collision mask of texture
 void setRegion(int x, int y, int width, int height)
          sets the region of the image
 
Methods inherited from interface zombie.interfaces.IDestroyable
destroy, isDestroyed
 
Methods inherited from interface zombie.interfaces.IMaskerable
getMask
 

Method Detail

bind

void bind()
bind the current texture in the VRAM


bind

void bind(int unit)
bind the current texture object in the specified texture unit

Parameters:
unit - the texture unit in witch the current TextureObject will be binded

getData

WrappedBuffer getData()
returns the texture's pixel in a ByteBuffer EXAMPLE:
ByteBuffer bb = getData();
byte r, g, b;
bb.rewind(); //<-- IMPORTANT!!
try {
while (true) {
bb.mark();
r = bb.get();
g = bb.get();
b = bb.get();
bb.reset();
bb.put((byte)(r+red));
bb.put((byte)(g+green));
bb.put((byte)(b+blue));
bb.get(); // alpha
}
} catch (Exception e) {
}
setData(bb);


getHeight

int getHeight()
returns the height of image

Returns:
the height of image

getHeightHW

int getHeightHW()
return the height hardware of image

Returns:

getID

int getID()
returns the ID of image in the Vram

Returns:
the ID of image in the Vram

getWidth

int getWidth()
returns the width of image

Returns:
the width of image

getWidthHW

int getWidthHW()
return the width Hardware of image

Returns:

getXEnd

float getXEnd()
returns the end X-coordinate

Returns:
the end X-coordinate

getXStart

float getXStart()
returns the start X-coordinate

Returns:
the start X-coordinate

getYEnd

float getYEnd()
returns the end Y-coordinate

Returns:
the end Y-coordinate

getYStart

float getYStart()
returns the start Y-coordinate

Returns:
the start Y-coordinate

isSolid

boolean isSolid()
indicates if the texture is solid or not.
a non solid texture is a texture that containe an alpha channel

Returns:
if the texture is solid or not.

makeTransp

void makeTransp(int red,
                int green,
                int blue)
sets transparent each pixel that it's equal to the red, green blue value specified

Parameters:
red - color used in the test
green - color used in the test
blue - color used in the test

setAlphaForeach

void setAlphaForeach(int red,
                     int green,
                     int blue,
                     int alpha)
sets the specified alpha for each pixel that it's equal to the red, green blue value specified

Parameters:
red - color used in the test
green - color used in the test
blue - color used in the test
alpha - the alpha color that will be setted to the pixel that pass the test

setData

void setData(java.nio.ByteBuffer data)
sets the texture's pixel from a ByteBuffer EXAMPLE:
ByteBuffer bb = getData();
byte r, g, b;
bb.rewind(); //<-- IMPORTANT!!
try {
while (true) {
bb.mark();
r = bb.get();
g = bb.get();
b = bb.get();
bb.reset();
bb.put((byte)(r+red));
bb.put((byte)(g+green));
bb.put((byte)(b+blue));
bb.get(); // alpha
}
} catch (Exception e) {
}
setData(bb);

Parameters:
data - texture's pixel data

setMask

void setMask(Mask mask)
Pixel collision mask of texture

Parameters:
mask -

setRegion

void setRegion(int x,
               int y,
               int width,
               int height)
sets the region of the image

Parameters:
x - xstart position
y - ystart position
width - width of the region
height - height of the region