com.jme3.scene.plugins.blender.textures
Class TexturePixel

java.lang.Object
  extended by com.jme3.scene.plugins.blender.textures.TexturePixel
All Implemented Interfaces:
java.lang.Cloneable

public class TexturePixel
extends java.lang.Object
implements java.lang.Cloneable

The class that stores the pixel values of a texture.


Field Summary
 float alpha
          The pixel data.
 float blue
          The pixel data.
 float green
          The pixel data.
 float intensity
          The pixel data.
 float red
          The pixel data.
 
Constructor Summary
TexturePixel()
           
 
Method Summary
 void add(TexturePixel pixel)
          This method adds the calues of the given pixel to the current pixel.
 void clamp(float min, float max)
          This method clamps the pixel values to the given borders.
 void clear()
          This method clears the pixel values.
 java.lang.Object clone()
           
 void divide(float value)
          This method divides the values of the given pixel by the given value.
 void fromARGB(float a, float r, float g, float b)
          Copies the values from the given values.
 void fromARGB16(short a, short r, short g, short b)
          Copies the values from the given values.
 void fromARGB8(byte a, byte r, byte g, byte b)
          Copies the values from the given values.
 void fromARGB8(int argb8)
          Copies the values from the given integer that stores the ARGB8 data.
 void fromColor(ColorRGBA colorRGBA)
          Copies the values from the given color.
 void fromIntensity(byte intensity)
          Copies the intensity from the given value.
 void fromIntensity(short intensity)
          Copies the intensity from the given value.
 void fromPixel(TexturePixel pixel)
          Copies the values from the given pixel.
 short getA16()
           
 byte getA8()
           
 short getB16()
           
 byte getB8()
           
 short getG16()
           
 byte getG8()
           
 byte getInt()
           
 short getR16()
           
 byte getR8()
           
 void merge(TexturePixel pixel)
          Merges two pixels (adds the values of each color).
 void mult(float value)
          This method multiplies the values of the given pixel by the given value.
 void negate()
          This method negates the colors.
 void setAlpha(byte alpha)
          This method sets the alpha value (converts it to float number from range <0, 1>).
 void setAlpha(short alpha)
          This method sets the alpha value (converts it to float number from range <0, 1>).
 int toARGB8()
          Stores the pixel values in the integer.
 void toRGBA(float[] result)
          Stores RGBA values in the given array.
 void toRGBA8(byte[] result)
          Stores the data in the given table.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

intensity

public float intensity
The pixel data.


red

public float red
The pixel data.


green

public float green
The pixel data.


blue

public float blue
The pixel data.


alpha

public float alpha
The pixel data.

Constructor Detail

TexturePixel

public TexturePixel()
Method Detail

fromPixel

public void fromPixel(TexturePixel pixel)
Copies the values from the given pixel.

Parameters:
pixel - the pixel that we read from

fromColor

public void fromColor(ColorRGBA colorRGBA)
Copies the values from the given color.

Parameters:
colorRGBA - the color that we read from

fromARGB

public void fromARGB(float a,
                     float r,
                     float g,
                     float b)
Copies the values from the given values.

Parameters:
a - the alpha value
r - the red value
g - the green value
b - the blue value

fromARGB8

public void fromARGB8(byte a,
                      byte r,
                      byte g,
                      byte b)
Copies the values from the given values.

Parameters:
a - the alpha value
r - the red value
g - the green value
b - the blue value

fromARGB16

public void fromARGB16(short a,
                       short r,
                       short g,
                       short b)
Copies the values from the given values.

Parameters:
a - the alpha value
r - the red value
g - the green value
b - the blue value

fromIntensity

public void fromIntensity(byte intensity)
Copies the intensity from the given value.

Parameters:
intensity - the intensity value

fromIntensity

public void fromIntensity(short intensity)
Copies the intensity from the given value.

Parameters:
intensity - the intensity value

setAlpha

public void setAlpha(byte alpha)
This method sets the alpha value (converts it to float number from range <0, 1>).

Parameters:
alpha - the alpha value

setAlpha

public void setAlpha(short alpha)
This method sets the alpha value (converts it to float number from range <0, 1>).

Parameters:
alpha - the alpha value

fromARGB8

public void fromARGB8(int argb8)
Copies the values from the given integer that stores the ARGB8 data.

Parameters:
argb8 - the data stored in an integer

toRGBA

public void toRGBA(float[] result)
Stores RGBA values in the given array.

Parameters:
result - the array to store values

toRGBA8

public void toRGBA8(byte[] result)
Stores the data in the given table.

Parameters:
result - the result table

toARGB8

public int toARGB8()
Stores the pixel values in the integer.

Returns:
the integer that stores the pixel values

getInt

public byte getInt()
Returns:
the intensity of the pixel

getA8

public byte getA8()
Returns:
the alpha value of the pixel

getR8

public byte getR8()
Returns:
the alpha red of the pixel

getG8

public byte getG8()
Returns:
the green value of the pixel

getB8

public byte getB8()
Returns:
the blue value of the pixel

getA16

public short getA16()
Returns:
the alpha value of the pixel

getR16

public short getR16()
Returns:
the alpha red of the pixel

getG16

public short getG16()
Returns:
the green value of the pixel

getB16

public short getB16()
Returns:
the blue value of the pixel

merge

public void merge(TexturePixel pixel)
Merges two pixels (adds the values of each color).

Parameters:
pixel - the pixel we merge with

negate

public void negate()
This method negates the colors.


clear

public void clear()
This method clears the pixel values.


add

public void add(TexturePixel pixel)
This method adds the calues of the given pixel to the current pixel.

Parameters:
pixel - the pixel we add

mult

public void mult(float value)
This method multiplies the values of the given pixel by the given value.

Parameters:
value - multiplication factor

divide

public void divide(float value)
This method divides the values of the given pixel by the given value. ATTENTION! Beware of the zero value. This will cause you NaN's in the pixel values.

Parameters:
value - division factor

clamp

public void clamp(float min,
                  float max)
This method clamps the pixel values to the given borders.

Parameters:
min - the minimum value
max - the maximum value

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object