ImageScience 3.0.0

imagescience.color
Class Wave2Color

java.lang.Object
  extended by imagescience.color.Wave2Color

public class Wave2Color
extends java.lang.Object

Converts wavelengths of light to corresponding RGBA color values. The underlying algorithm is based on the FORTRAN program by Dan Bruton available on his Color Science website and uses piecewise linear models of the sensitivity curves of the components.


Constructor Summary
Wave2Color()
          Default constructor.
 
Method Summary
 java.awt.Color color(double wavelen)
          Converts a wavelength to its corresponding RGBA color values.
 double[] rgba(double wavelen)
          Converts a wavelength to its corresponding RGBA color values.
 void rgba(double wavelen, double[] rgba)
          Converts a wavelength to its corresponding RGBA color values.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Wave2Color

public Wave2Color()
Default constructor.

Method Detail

rgba

public void rgba(double wavelen,
                 double[] rgba)
Converts a wavelength to its corresponding RGBA color values.

Parameters:
wavelen - The wavelength (in nanometers) to be converted.
rgba - The double array in which the RGBA values will be stored:
[0] = the value of the red (R) component,
[1] = the value of the green (G) component,
[2] = the value of the blue (B) component,
[3] = the value of the alpha (A) component.
The value of each component is in the range [0.0,1.0].
Throws:
java.lang.NullPointerException - If rgba is null.
java.lang.ArrayIndexOutOfBoundsException - If the length of rgba is not 4.

rgba

public double[] rgba(double wavelen)
Converts a wavelength to its corresponding RGBA color values.

Parameters:
wavelen - The wavelength (in nanometers) to be converted.
Returns:
A new double array with four elements:
[0] = the value of the red (R) component,
[1] = the value of the green (G) component,
[2] = the value of the blue (B) component,
[3] = the value of the alpha (A) component.
The value of each component is in the range [0.0,1.0].

color

public java.awt.Color color(double wavelen)
Converts a wavelength to its corresponding RGBA color values.

Parameters:
wavelen - The wavelength (in nanometers) to be converted.
Returns:
A new Color object containing the RGBA color values.

ImageScience 3.0.0

Copyright (C) Erik Meijering. Permission to use this software and corresponding documentation for educational, research, and not-for-profit purposes, without a fee and without a signed licensing agreement, is granted, subject to the following terms and conditions.

IT IS NOT ALLOWED TO REDISTRIBUTE, SELL, OR LEASE THIS SOFTWARE, OR DERIVATIVE WORKS THEREOF, WITHOUT PERMISSION IN WRITING FROM THE COPYRIGHT HOLDER. THE COPYRIGHT HOLDER IS FREE TO MAKE VERSIONS OF THE SOFTWARE AVAILABLE FOR A FEE OR COMMERCIALLY ONLY.

IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OF ANY KIND WHATSOEVER, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.

THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE EXPRESS OR IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE AND CORRESPONDING DOCUMENTATION IS PROVIDED "AS IS". THE COPYRIGHT HOLDER HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.