|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.gwoptics.graphics.GWColour
public final class GWColour
Simple class that encapsulates the 4 colour components alpha, red, green and blue. It should be noted that the values should be stored as normalised floats between 0.0f and 1.0f not 0 and 255. Contains several functions to relate ARGB as a 32-bit integer using bit shifting.
Field Summary | |
---|---|
float |
A
|
float |
B
|
float |
G
|
float |
R
|
Constructor Summary | |
---|---|
GWColour()
Default GWColour constructor assign a black colour with full opactiy |
|
GWColour(float Red,
float Green,
float Blue)
GWColour constructor allowing user defined RGB values. |
|
GWColour(float Alpha,
float Red,
float Green,
float Blue)
Colour constructor allowing user defined RGB values. |
|
GWColour(int colour)
GWColour constructor accepting an integer representing the A, R, G and B components of a colour |
|
GWColour(int Red,
int Green,
int Blue)
Colour constructor allowing user defined RGB values. |
|
GWColour(int alpha,
int Red,
int Green,
int Blue)
|
Method Summary | |
---|---|
static GWColour |
add(GWColour c1,
GWColour c2)
Adds 2 colours |
static int |
convertARGBToInt(byte A,
byte R,
byte G,
byte B)
A static function used to convert 0 to 255 values or ARGB into an integer. |
static int |
convertColourToInt(GWColour c)
Static function to convert a Colour object into an integer. |
static GWColour |
convertIntToColour(int iC)
Static function to convert an integer into a Colour object. |
static int |
convertRGBToInt(byte R,
byte G,
byte B)
A static function used to convert 0 to 255 values of RGB into an integer. |
static int |
getAlphaRGB(GWColour c)
Returns int version of a Colour but applies, alpha to each channel |
static GWColour |
multiply(GWColour c1,
GWColour c2)
Multiplies 2 colours |
int |
toAlphaInt()
Converts Colour object into an integer. |
int |
toInt()
Converts Colour object into an integer. |
java.lang.String |
toString()
Returns a string in the format (R,G,B). |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public float A
public float R
public float G
public float B
Constructor Detail |
---|
public GWColour()
public GWColour(int colour)
public GWColour(float Red, float Green, float Blue)
Red
- Red value between 0.0f and 1.0f.Green
- Green value between 0.0f and 1.0f.Blue
- Blue value between 0.0f and 1.0f.public GWColour(float Alpha, float Red, float Green, float Blue)
Alpha
- Alpha value between 0.0f and 1.0f.Red
- Red value between 0.0f and 1.0f.Green
- Green value between 0.0f and 1.0f.Blue
- Blue value between 0.0f and 1.0f.public GWColour(int Red, int Green, int Blue)
Red
- Red value between 0 and 255.Green
- Green value between 0 and 255.Blue
- Blue value between 0 and 255.public GWColour(int alpha, int Red, int Green, int Blue)
Method Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
public static int convertRGBToInt(byte R, byte G, byte B)
R
- Red value between 0 and 255G
- Green value between 0 and 255B
- Blue value between 0 and 255
public static int convertARGBToInt(byte A, byte R, byte G, byte B)
A
- Alpha value between 0 and 255R
- Red value between 0 and 255G
- Green value between 0 and 255B
- Blue value between 0 and 255
public static int convertColourToInt(GWColour c)
c
- Colour object
public static GWColour convertIntToColour(int iC)
iC
- Integer to convert
public static GWColour add(GWColour c1, GWColour c2)
public static GWColour multiply(GWColour c1, GWColour c2)
public static int getAlphaRGB(GWColour c)
public int toInt()
public int toAlphaInt()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |