com.threed.jpct
Class RGBColor

java.lang.Object
  extended by com.threed.jpct.RGBColor
All Implemented Interfaces:
java.io.Serializable

public class RGBColor
extends java.lang.Object
implements java.io.Serializable

Mimics the Color-class in java.awt as far as jPCT-AE needs it to run.

See Also:
Serialized Form

Field Summary
static RGBColor BLACK
           
static RGBColor BLUE
           
static RGBColor GREEN
           
static RGBColor RED
           
static RGBColor WHITE
           
 
Constructor Summary
RGBColor()
          Creates a new, black color.
RGBColor(int r, int g, int b)
          Creates a new color.
RGBColor(int r, int g, int b, int a)
          Creates a new color with alpha.
 
Method Summary
 int getAlpha()
          Returns the alpha value (0..255).
 int getARGB()
          Returns the color as an int argb value with alpha.
 int getBlue()
          Returns the blue value (0..255).
 int getGreen()
          Returns the green value (0..255).
 float getNormalizedAlpha()
          Returns the alpha value in normalized form (0..1).
 float getNormalizedBlue()
          Returns the blue value in normalized form (0..1).
 float getNormalizedGreen()
          Returns the green value in normalized form (0..1).
 float getNormalizedRed()
          Returns the red value in normalized form (0..1).
 int getRed()
          Returns the red value (0..255).
 int getRGB()
          Returns the color as an int rgb value.
 void setTo(int r, int g, int b, int a)
          Modifies and existing instance of RGBColor.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BLACK

public static final RGBColor BLACK

WHITE

public static final RGBColor WHITE

RED

public static final RGBColor RED

GREEN

public static final RGBColor GREEN

BLUE

public static final RGBColor BLUE
Constructor Detail

RGBColor

public RGBColor()
Creates a new, black color.


RGBColor

public RGBColor(int r,
                int g,
                int b)
Creates a new color. Alpha for this color will be set to 0.

Parameters:
r - red value between 0 and 255
g - green value between 0 and 255
b - blue value between 0 and 255

RGBColor

public RGBColor(int r,
                int g,
                int b,
                int a)
Creates a new color with alpha.

Parameters:
r - red value between 0 and 255
g - green value between 0 and 255
b - blue value between 0 and 255
a - alpha value between 0 and 255
Method Detail

setTo

public void setTo(int r,
                  int g,
                  int b,
                  int a)
Modifies and existing instance of RGBColor. Might have no influence on already set colors.

Parameters:
r - red value between 0 and 255
g - green value between 0 and 255
b - blue value between 0 and 255
a - alpha value between 0 and 255

getNormalizedRed

public float getNormalizedRed()
Returns the red value in normalized form (0..1).

Returns:
red

getNormalizedGreen

public float getNormalizedGreen()
Returns the green value in normalized form (0..1).

Returns:
green

getNormalizedBlue

public float getNormalizedBlue()
Returns the blue value in normalized form (0..1).

Returns:
blue

getNormalizedAlpha

public float getNormalizedAlpha()
Returns the alpha value in normalized form (0..1).

Returns:
alpha

getRed

public int getRed()
Returns the red value (0..255).

Returns:
red

getBlue

public int getBlue()
Returns the blue value (0..255).

Returns:
blue

getGreen

public int getGreen()
Returns the green value (0..255).

Returns:
green

getAlpha

public int getAlpha()
Returns the alpha value (0..255).

Returns:
alpha

getRGB

public int getRGB()
Returns the color as an int rgb value.

Returns:
the color

getARGB

public int getARGB()
Returns the color as an int argb value with alpha.

Returns:
the color