: Class Colour
Class Tree Index Help PREV CLASS NEXT CLASS FRAMES NO FRAMES SUMMARY: INNER | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD Class Colour
java.lang.Object
|
+--Colour
public class Colour extends java.lang.Object 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. 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 R
public double R Holds the red component of the colour G
public double G Holds the green component of the colour B
public double B Holds the blue component of the colour Constructor Detail Colour
public Colour() Create a new colour and set it to the default colour (black) Colour
public Colour(double r,
double g,
double b) Create a new colour with the given red green and blue values Parameters: r - the red component g - the green component b - the blue component Colour
public Colour(Colour c) Create a new colour by copying an existing colour Parameters: c - the colour to copy Method Detail copy
public void copy(Colour c) Copying an existing colour to this colour Parameters: c - the colour to copy reset
public void reset() Reset the colour to the default colour (black) clamp
public void clamp() Clamp each component of the colour to lie within the range 0.0 to 1.0 add
public void add(Colour c) Add the given colour to this colour Parameters: c - the colour to add add
public static Colour add(Colour c1,
Colour c2) Static implementation of colour add function that creates a new colour object from the result. Parameters: c1 - the first colour to add c2 - the second colour to add Returns: a new colour object with the results add
public 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. Parameters: cd - the colour to write the result to c1 - the first colour to add c2 - the second colour to add mult
public void mult(Colour c) Multiply the given colour to this colour Parameters: c - the colour to multiply mult
public static Colour mult(Colour c1,
Colour c2) Static implementation of colour mult function that creates a new colour object from the result. Parameters: c1 - the first colour to add c2 - the second colour to add Returns: a new colour object with the results mult
public 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. Parameters: cd - the colour to write the result to c1 - the first colour to multiply c2 - the second colour to multiply scale
public void scale(double s) Scale this colour by the given factor Parameters: s - the scale factor scale
public static Colour scale(Colour c1,
double s) Static scale function that returns a new colour scaled by the given factor Parameters: c1 - the colour to scale s - the scale factor scale
public 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 Parameters: cd - the destination colour c1 - the colour to scale s - the scale factor getColor
public java.awt.Color getColor() Create a standard java Color object from this colour for rendering purposes. given factor to a given destination Returns: a new Color object equivalent to the current RGB values read
public void read(SceneReader is)
throws java.io.IOException,
java.lang.NumberFormatException Read the colour from the given source Parameters: is - the source to read from Throws: java.io.IOException - if the light can not be read java.io.NumberFormatException - if there a number format error is encountered write
public void write(SceneWriter os)
throws java.io.IOException Write the colour to the given destination Parameters: os - the destination to write to Throws: java.io.IOException - if the write fails. print
public void print(SceneWriter os)
throws java.io.IOException Print a human readable version of the colour definition to the given destination Parameters: os - the destination to write to Throws: java.io.IOException - if the write fails. Class Tree Index Help PREV CLASS NEXT CLASS FRAMES NO FRAMES SUMMARY: INNER | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD