com.jhlabs.image
Class LinearColormap

java.lang.Object
  extended by com.jhlabs.image.LinearColormap
All Implemented Interfaces:
Colormap, java.io.Serializable

public class LinearColormap
extends java.lang.Object
implements Colormap, java.io.Serializable

A colormap which interpolates linearly between two colors.

See Also:
Serialized Form

Constructor Summary
LinearColormap()
          Construct a color map with a grayscale ramp from black to white
LinearColormap(int color1, int color2)
          Construct a linear color map
 
Method Summary
 int getColor(float v)
          Convert a value in the range 0..1 to an RGB color.
 int getColor1()
          Get the first color
 int getColor2()
          Get the second color
 void setColor1(int color1)
          Set the first color
 void setColor2(int color2)
          Set the second color
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinearColormap

public LinearColormap()
Construct a color map with a grayscale ramp from black to white


LinearColormap

public LinearColormap(int color1,
                      int color2)
Construct a linear color map

Parameters:
color1 - the color corresponding to value 0 in the colormap
color2 - the color corresponding to value 1 in the colormap
Method Detail

setColor1

public void setColor1(int color1)
Set the first color

Parameters:
color1 - the color corresponding to value 0 in the colormap

getColor1

public int getColor1()
Get the first color

Returns:
the color corresponding to value 0 in the colormap

setColor2

public void setColor2(int color2)
Set the second color

Parameters:
color2 - the color corresponding to value 1 in the colormap

getColor2

public int getColor2()
Get the second color

Returns:
the color corresponding to value 1 in the colormap

getColor

public int getColor(float v)
Convert a value in the range 0..1 to an RGB color.

Specified by:
getColor in interface Colormap
Parameters:
v - a value in the range 0..1
Returns:
an RGB color