|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--raja.RGB
A class to encapsulate a high precision wavelength-dependent nonnegative
value.
The wavelength-dependent nonnegative value is defined by its
samples at the Red, Green and Blue wavelengths.
The samples can be any nonnegative double value; in particular,
Double#POSITIVE_INFINITY is allowed. Note that for a color
the samples should range from 0 to 1 (see getColor()).
Color, Serialized Form| Field Summary | |
static RGB |
black
The RGB wavelength-dependent value corresponding to the
black color. |
static RGB |
blue
The RGB wavelength-dependent value corresponding to the
blue color. |
static RGB |
cyan
The RGB wavelength-dependent value corresponding to the
cyan color. |
static RGB |
green
The RGB wavelength-dependent value corresponding to the
green color. |
static RGB |
magenta
The RGB wavelength-dependent value corresponding to the
magenta color. |
static RGB |
red
The RGB wavelength-dependent value corresponding to the
red color. |
static RGB |
white
The RGB wavelength-dependent value corresponding to the
white color. |
static RGB |
yellow
The RGB wavelength-dependent value corresponding to the
yellow color. |
| Constructor Summary | |
RGB(Color c)
Creates an RGB wavelength-dependent value corresponding
to the specified Color. |
|
RGB(double c)
Creates an RGB constant value initialized with the
specified double value. |
|
RGB(double r,
double g,
double b)
Creates an RGB wavelength-dependent value initialized
with the specified red, green, and blue samples. |
|
| Method Summary | |
static Object |
build(ObjectReader reader)
Creates an RGB object from the specified
ObjectReader. |
boolean |
equals(Object obj)
Compares this object to the specified object. |
Color |
getColor()
Returns the Color corresponding to this RGB
wavelength-dependent value. |
static RGB |
inverse(RGB rgb)
Computes the componentwise inverse of the specified RGB wavelength-dependent value. |
boolean |
isSmaller(RGB rgb)
Compares this RGB wavelength-dependent value with the
specified RGB wavelength-dependent value. |
static RGB |
max(RGB rgb1,
RGB rgb2)
Computes the componentwise max of the two specified RGB wavelength-dependent values. |
static RGB |
product(RGB rgb,
double f)
Computes the product of the specified RGB
wavelength-dependent value with the specified double factor. |
static RGB |
product(RGB rgb1,
RGB rgb2)
Computes the componentwise product of the two specified RGB wavelength-dependent values. |
static RGB |
sum(RGB rgb1,
RGB rgb2)
Computes the componentwise sum of the two specified RGB wavelength-dependent values. |
String |
toString()
Returns a textual String representation of this
RGB object. |
void |
write(ObjectWriter writer)
Writes the contents of this RGB object to the specified
ObjectWriter. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final RGB black
RGB wavelength-dependent value corresponding to the
black color.public static final RGB blue
RGB wavelength-dependent value corresponding to the
blue color.public static final RGB cyan
RGB wavelength-dependent value corresponding to the
cyan color.public static final RGB green
RGB wavelength-dependent value corresponding to the
green color.public static final RGB magenta
RGB wavelength-dependent value corresponding to the
magenta color.public static final RGB red
RGB wavelength-dependent value corresponding to the
red color.public static final RGB yellow
RGB wavelength-dependent value corresponding to the
yellow color.public static final RGB white
RGB wavelength-dependent value corresponding to the
white color.| Constructor Detail |
public RGB(double r,
double g,
double b)
RGB wavelength-dependent value initialized
with the specified red, green, and blue samples.r - a nonnegative double value corresponding to
the red sample.g - a nonnegative double value corresponding to
the green sample.b - a nonnegative double value corresponding to
the blue sample.public RGB(double c)
RGB constant value initialized with the
specified double value.c - a nonnegative double value.public RGB(Color c)
RGB wavelength-dependent value corresponding
to the specified Color.c - the color to be represented by the RGB object.getColor()| Method Detail |
public static Object build(ObjectReader reader)
throws IOException
RGB object from the specified
ObjectReader.reader - the ObjectReader to read the
fields from.public boolean equals(Object obj)
true if and only if the argument is not
null and is an RGB object that represents
the same wavelength-dependent value as this object (i.e. their
samples are the same).equals in class Objectobj - the object to compare with.true if the objects are the same;
false otherwise.
public static RGB sum(RGB rgb1,
RGB rgb2)
RGB wavelength-dependent values.rgb1, rgb2 - the RGB wavelength-dependent
values to sum.RGB that is the componentwise
sum of the two specified RGB
wavelength-dependent values.
public static RGB product(RGB rgb1,
RGB rgb2)
RGB wavelength-dependent values.rgb1, rgb2 - the RGB wavelength-dependent
values to product.RGB that is the componentwise
product of the two specified RGB
wavelength-dependent values.
public static RGB product(RGB rgb,
double f)
RGB
wavelength-dependent value with the specified double factor.rgb - the RGB wavelength-dependent value
to product with.f - the double factor.RGB that is the product of the
specified RGB wavelength-dependent value with
the specified double factor.
public static RGB max(RGB rgb1,
RGB rgb2)
RGB wavelength-dependent values.rgb1, rgb2 - the RGB values to compare.RGB that is the componentwise max
of the two specified RGB wavelength-dependent
values.public static RGB inverse(RGB rgb)
RGB wavelength-dependent value.
The inverse of a zero sample is Double#POSITIVE_INFINITY.rgb - the RGB value to inverse.RGB that is the componentwise
inverse of the specified RGB
wavelength-dependent value.public boolean isSmaller(RGB rgb)
RGB wavelength-dependent value with the
specified RGB wavelength-dependent value.rgb - the RGB value to compare with.true if this RGB
wavelength-dependent value is smaller than the specified
RGB wavelength-dependent value;
false otherwise.public Color getColor()
Color corresponding to this RGB
wavelength-dependent value.
Each sample greater than 1 is truncated to 1 as this is the maximal
value for a Color's component.Color object corresponding to this
RGB wavelength-dependent value.public String toString()
String representation of this
RGB object.toString in class Object
public void write(ObjectWriter writer)
throws IOException
RGB object to the specified
ObjectWriter.write in interface Writablewriter - the ObjectWriter to write the
fields to.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||