sim.portrayal3d
Class SimpleColorInterpolator

java.lang.Object
  extended bysim.portrayal3d.SimpleColorInterpolator
All Implemented Interfaces:
ColorCoding

public class SimpleColorInterpolator
extends java.lang.Object
implements ColorCoding


Field Summary
 java.awt.Color clearColor
           
static int COLOR_DISCRETIZATION
           
 java.awt.Color[] colors
          User-provided color table
 int maxAlpha
           
 int maxBlue
           
 int maxGreen
           
 double maxLevel
           
 int maxRed
           
 int minAlpha
           
 int minBlue
           
 java.awt.Color minColor
           
 int minGreen
           
 double minLevel
           
 int minRed
           
 
Constructor Summary
SimpleColorInterpolator()
           
SimpleColorInterpolator(java.awt.Color[] colors)
           
 
Method Summary
 java.awt.Color getColor(double level)
          Override this if you'd like to customize the color for values in the portrayal.
 java.awt.Color[] setColorTable(java.awt.Color[] colors)
          Specifies that if a value (cast into an int) in the IntGrid2D or DoubleGrid2D falls in the range 0 ...
 void setLevels(double minLevel, double maxLevel, java.awt.Color minColor, java.awt.Color maxColor)
          Sets the color levels for the ValueGrid2DPortrayal values for use by the default getColor(...) method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

minRed

public int minRed

minBlue

public int minBlue

minGreen

public int minGreen

minAlpha

public int minAlpha

maxRed

public int maxRed

maxBlue

public int maxBlue

maxGreen

public int maxGreen

maxAlpha

public int maxAlpha

maxLevel

public double maxLevel

minLevel

public double minLevel

clearColor

public final java.awt.Color clearColor

minColor

public java.awt.Color minColor

COLOR_DISCRETIZATION

public static final int COLOR_DISCRETIZATION
See Also:
Constant Field Values

colors

public java.awt.Color[] colors
User-provided color table

Constructor Detail

SimpleColorInterpolator

public SimpleColorInterpolator()

SimpleColorInterpolator

public SimpleColorInterpolator(java.awt.Color[] colors)
Method Detail

setLevels

public void setLevels(double minLevel,
                      double maxLevel,
                      java.awt.Color minColor,
                      java.awt.Color maxColor)
Sets the color levels for the ValueGrid2DPortrayal values for use by the default getColor(...) method. These are overridden by any array provided in setColorTable(). If the value in the IntGrid2D or DoubleGrid2D is less than or equal to minLevel, then minColor is used. If the value is greater than or equal to maxColor, then maxColor is used. Otherwise a linear interpolation from minColor to maxColor is used.


setColorTable

public java.awt.Color[] setColorTable(java.awt.Color[] colors)
Specifies that if a value (cast into an int) in the IntGrid2D or DoubleGrid2D falls in the range 0 ... colors.length, then that index in the colors table should be used to represent that value. Otherwise, values in setLevels(...) are used. You can remove the color table by passing in null here. Returns the old color table.


getColor

public java.awt.Color getColor(double level)
Override this if you'd like to customize the color for values in the portrayal. The default version looks up the value in the colors[] table, else computes the interpolated color and grabs it out of a predefined color cache (there can't be more than about 1024 or so interpolated colors, max).

Specified by:
getColor in interface ColorCoding