|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Colour
Colour stores a RGB triple and supports several operations to manipulate colour values
Field Summary | |
double |
B
Holds the blue component of the colour |
double |
G
Holds the green component of the colour |
double |
R
Holds the red component of the colour |
Constructor Summary | |
Colour()
Create a new colour and set it to the default colour (black) |
|
Colour(Colour c)
Create a new colour by copying an existing colour |
|
Colour(double r,
double g,
double b)
Create a new colour with the given red green and blue values |
Method Summary | |
void |
add(Colour c)
Add the given colour to this colour |
static Colour |
add(Colour c1,
Colour c2)
Static implementation of colour add function that creates a new colour object from the result. |
static void |
add(Colour cd,
Colour c1,
Colour c2)
Static implementation of colour add function that write the result of the addition to a given colour object. |
void |
clamp()
Clamp each component of the colour to lie within the range 0.0 to 1.0 |
void |
copy(Colour c)
Copying an existing colour to this colour |
java.awt.Color |
getColor()
Create a standard java Color object from this
colour for rendering purposes. |
boolean |
isBlack()
Test if the colour is black |
void |
mult(Colour c)
Multiply the given colour to this colour |
static Colour |
mult(Colour c1,
Colour c2)
Static implementation of colour mult function that creates a new colour object from the result. |
static void |
mult(Colour cd,
Colour c1,
Colour c2)
Static implementation of colour mult function that write the result of the multiplication to a given colour object. |
void |
print(SceneWriter os)
Print a human readable version of the colour definition to the given destination |
void |
read(SceneReader is)
Read the colour from the given source |
void |
reset()
Reset the colour to the default colour (black) |
static void |
scale(Colour cd,
Colour c1,
double s)
Static scale function that writes the colour scaled by the given factor to a given destination |
static Colour |
scale(Colour c1,
double s)
Static scale function that returns a new colour scaled by the given factor |
void |
scale(double s)
Scale this colour by the given factor |
void |
write(SceneWriter os)
Write the colour to the given destination |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public double R
public double G
public double B
Constructor Detail |
public Colour()
public Colour(double r, double g, double b)
r
- the red componentg
- the green componentb
- the blue componentpublic Colour(Colour c)
c
- the colour to copyMethod Detail |
public void copy(Colour c)
c
- the colour to copypublic void reset()
public void clamp()
public void add(Colour c)
c
- the colour to addpublic boolean isBlack()
public static Colour add(Colour c1, Colour c2)
c1
- the first colour to addc2
- the second colour to add
public static void add(Colour cd, Colour c1, Colour c2)
cd
- the colour to write the result toc1
- the first colour to addc2
- the second colour to addpublic void mult(Colour c)
c
- the colour to multiplypublic static Colour mult(Colour c1, Colour c2)
c1
- the first colour to addc2
- the second colour to add
public static void mult(Colour cd, Colour c1, Colour c2)
cd
- the colour to write the result toc1
- the first colour to multiplyc2
- the second colour to multiplypublic void scale(double s)
s
- the scale factorpublic static Colour scale(Colour c1, double s)
c1
- the colour to scales
- the scale factorpublic static void scale(Colour cd, Colour c1, double s)
cd
- the destination colourc1
- the colour to scales
- the scale factorpublic java.awt.Color getColor()
Color
object from this
colour for rendering purposes.
given factor to a given destination
Color
object equivalent to the current RGB valuespublic void read(SceneReader is) throws java.io.IOException, java.lang.NumberFormatException
is
- the source to read from
java.io.IOException
- if the light can not be read
java.io.NumberFormatException
- if there a number format error is encountered
java.lang.NumberFormatException
public void write(SceneWriter os) throws java.io.IOException
os
- the destination to write to
java.io.IOException
- if the write fails.public void print(SceneWriter os) throws java.io.IOException
os
- the destination to write to
java.io.IOException
- if the write fails.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |