Class ColorScale

java.lang.Object
  extended by ColorScale

public class ColorScale
extends Object

Represents an n-color scale as a smooth transition between the two terminal colors in the scale.


Constructor Summary
ColorScale()
          Constructs a default (gray) scale from white to black with 10 levels.
ColorScale(Color first, Color last, int size)
          Constructs a scale from first to last values specified, with the specified number of levels.
 
Method Summary
 Color get(int level)
          Returns a reference to the specified color level.
 int size()
          Returns the size of the scale.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorScale

public ColorScale()
Constructs a default (gray) scale from white to black with 10 levels.


ColorScale

public ColorScale(Color first,
                  Color last,
                  int size)
Constructs a scale from first to last values specified, with the specified number of levels.

Parameters:
first - the first color value.
last - the last color value.
size - the number of levels - assumed to be > 0.
Method Detail

get

public Color get(int level)
Returns a reference to the specified color level.

Parameters:
level - the color level to get - assumed to be in range of 0 to size()-1.
Returns:
color value at specified level.

size

public int size()
Returns the size of the scale.

Returns:
the number of levels in this scale.