ui.recognizer
Class MonochromaticColor

java.lang.Object
  extended by java.awt.Color
      extended by ui.recognizer.MonochromaticColor
All Implemented Interfaces:
Paint, Transparency, Serializable

public class MonochromaticColor
extends Color

Represents the color of visible light for a given wavelenth between between 380 nm and 780 nm. Originally from a program by Dan Bruton at http://www.physics.sfasu.edu/astro/color/spectra.html

Author:
John Talbot
See Also:
Serialized Form

Field Summary
static double BLUE_SENSITIVITY_DROP
           
static double MAXIMUM_INTENSITY
           
static double MAXIMUM_WAVELENGTH
           
static double MINIMUM_WAVELENGTH
           
static double RED_SENSITIVITY_DROP
           
static double TYPICAL_GAMMA
           
static double WAVELENGTH_BLUE
           
static double WAVELENGTH_CYAN
           
static double WAVELENGTH_GREEN
           
static double WAVELENGTH_RED
           
static double WAVELENGTH_YELLOW
           
 
Fields inherited from class java.awt.Color
black, BLACK, blue, BLUE, cyan, CYAN, DARK_GRAY, darkGray, gray, GRAY, green, GREEN, LIGHT_GRAY, lightGray, magenta, MAGENTA, orange, ORANGE, pink, PINK, red, RED, white, WHITE, yellow, YELLOW
 
Fields inherited from interface java.awt.Transparency
BITMASK, OPAQUE, TRANSLUCENT
 
Constructor Summary
MonochromaticColor(double aWavelength)
          Construct a monochromatic color based on a wavelength between 380 nm and 780 nm
MonochromaticColor(double aWavelength, double intensity)
          Construct a monochromatic color based on a wavelength between 380 nm and 780 nm and enhance the contrast using a gamma value.
MonochromaticColor(double aWavelength, double intensity, double aGamma)
          Construct a monochromatic color based on a wavelength between 380 nm and 780 nm and enhance the contrast using a gamma value.
 
Method Summary
static float[] getColorComponents(double aWavelength, double intensity, double aGamma)
          Get a monochromatic color based on a wavelength between 380 nm and 780 nm and scale the brightness by an intensity parameter between zero and one.
 double getGamma()
          Get the gamma, a number which can be used to enhance the contrast of darker colors.
 double getWavelength()
          Get the wavelength in meters which this color represents.
static void main(String[] args)
           
 void setGamma(double aGamma)
          Set the gamma, a number which can be used to enhance the contrast of darker colors.
 void setWavelength(double aWavelength)
          Set the wavelength in meters, and change this color to the closest color match.
 void setWavelengthInAngtroms(double aWavelengthInAngtroms)
          Set the wavelength in angstrom units and change this color to the closest color match.
 void setWavelengthInNanoMeters(double aWavelengthInNanoMeters)
          Set the wavelength in nanometers and change this color to the closest color match.
 
Methods inherited from class java.awt.Color
brighter, createContext, darker, decode, equals, getAlpha, getBlue, getColor, getColor, getColor, getColorComponents, getColorComponents, getColorSpace, getComponents, getComponents, getGreen, getHSBColor, getRed, getRGB, getRGBColorComponents, getRGBComponents, getTransparency, hashCode, HSBtoRGB, RGBtoHSB, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MINIMUM_WAVELENGTH

public static final double MINIMUM_WAVELENGTH
See Also:
Constant Field Values

WAVELENGTH_BLUE

public static final double WAVELENGTH_BLUE
See Also:
Constant Field Values

WAVELENGTH_CYAN

public static final double WAVELENGTH_CYAN
See Also:
Constant Field Values

WAVELENGTH_GREEN

public static final double WAVELENGTH_GREEN
See Also:
Constant Field Values

WAVELENGTH_YELLOW

public static final double WAVELENGTH_YELLOW
See Also:
Constant Field Values

WAVELENGTH_RED

public static final double WAVELENGTH_RED
See Also:
Constant Field Values

MAXIMUM_WAVELENGTH

public static final double MAXIMUM_WAVELENGTH
See Also:
Constant Field Values

BLUE_SENSITIVITY_DROP

public static final double BLUE_SENSITIVITY_DROP
See Also:
Constant Field Values

RED_SENSITIVITY_DROP

public static final double RED_SENSITIVITY_DROP
See Also:
Constant Field Values

TYPICAL_GAMMA

public static final double TYPICAL_GAMMA
See Also:
Constant Field Values

MAXIMUM_INTENSITY

public static final double MAXIMUM_INTENSITY
See Also:
Constant Field Values
Constructor Detail

MonochromaticColor

public MonochromaticColor(double aWavelength)
Construct a monochromatic color based on a wavelength between 380 nm and 780 nm

Parameters:
aWavelength - the wavelength of the visible radiation in meters

MonochromaticColor

public MonochromaticColor(double aWavelength,
                          double intensity)
Construct a monochromatic color based on a wavelength between 380 nm and 780 nm and enhance the contrast using a gamma value.

Parameters:
aWavelength - the wavelength of the visible radiation in meters
intensity - a number between 0 and 1.0 (MAXIMUM_INTENSITY) which is to multiply the color

MonochromaticColor

public MonochromaticColor(double aWavelength,
                          double intensity,
                          double aGamma)
Construct a monochromatic color based on a wavelength between 380 nm and 780 nm and enhance the contrast using a gamma value.

Parameters:
aWavelength - the wavelength of the visible radiation in meters
intensity - a number between 0 and 1.0 (MAXIMUM_INTENSITY) which is to multiply the color
aGamma - a number which can be used to enhance the contrast of darker colors
Method Detail

getColorComponents

public static float[] getColorComponents(double aWavelength,
                                         double intensity,
                                         double aGamma)
Get a monochromatic color based on a wavelength between 380 nm and 780 nm and scale the brightness by an intensity parameter between zero and one. The contrast is enhanced using a gamma value between 0.0 and 1.0.

Parameters:
aWavelength - the wavelength of the visible radiation in meters
intensity - a number between 0 and 1.0 which is to multiply the color
aGamma - a number which can be used to enhance the contrast of darker colors
Returns:
a color which represents one wavelength of visible light

main

public static void main(String[] args)

getWavelength

public double getWavelength()
Get the wavelength in meters which this color represents.

Returns:
a floating point number representing the wavelength in meters

setWavelength

public void setWavelength(double aWavelength)
Set the wavelength in meters, and change this color to the closest color match.

Parameters:
aWavelength - a floating point number representing the wavelength in meters

setWavelengthInNanoMeters

public void setWavelengthInNanoMeters(double aWavelengthInNanoMeters)
Set the wavelength in nanometers and change this color to the closest color match.

Parameters:
aWavelengthInNanoMeters - a floating point number representing the wavelength in meters

setWavelengthInAngtroms

public void setWavelengthInAngtroms(double aWavelengthInAngtroms)
Set the wavelength in angstrom units and change this color to the closest color match.

Parameters:
aWavelengthInAngtroms - a floating point number representing the wavelength in meters

setGamma

public void setGamma(double aGamma)
Set the gamma, a number which can be used to enhance the contrast of darker colors.

Parameters:
aGamma - a number representing the gamma of the color

getGamma

public double getGamma()
Get the gamma, a number which can be used to enhance the contrast of darker colors.

Returns:
a number representing the gamma of the color