public class CompositeColorMap extends java.lang.Object implements ColorMap
This is a simple way of defining multiple gradients from different colors in the same space (such as red->green->blue->white->black)
Constructor and Description |
---|
CompositeColorMap(ColorMap[] maps)
Builds a CompositeColorMap with an arbitrary number (> 0) of subsidiary maps
|
CompositeColorMap(ColorMap map1,
ColorMap map2)
Builds a CompositeColorMap with two subsidiary maps
|
CompositeColorMap(ColorMap map1,
ColorMap map2,
ColorMap map3)
Builds a CompositeColorMap with three subsidiary maps
|
CompositeColorMap(ColorMap map1,
ColorMap map2,
ColorMap map3,
ColorMap map4)
Builds a CompositeColorMap with four subsidiary maps
|
Modifier and Type | Method and Description |
---|---|
double |
defaultValue()
Returns some level which is valid (that is, validLevel(defaultValue()) should
always return true).
|
int |
getAlpha(double level)
Returns the alpha value for a color for the given level.
|
java.awt.Color |
getColor(double level)
Returns a color for the given level
|
int |
getRGB(double level)
Returns the RGB values, plus alpha, for a color for the given level.
|
boolean |
validLevel(double level)
Returns true if a level is "valid" (it provides a meaningful color)
|
public CompositeColorMap(ColorMap map1, ColorMap map2)
public CompositeColorMap(ColorMap map1, ColorMap map2, ColorMap map3)
public CompositeColorMap(ColorMap map1, ColorMap map2, ColorMap map3, ColorMap map4)
public CompositeColorMap(ColorMap[] maps)
public java.awt.Color getColor(double level)
ColorMap
public int getRGB(double level)
ColorMap
Why isn't this called getRGBA(...)? Because for some reason the underlying Color
method is likewise getRGB(), even though it ought to be called getRGBA().
... however it's likely that this method could be written more efficiently than this.
public int getAlpha(double level)
ColorMap
return getRGB(level) >>> 24 ;
...or it could be written as:
return getColor(level).getAlpha()
...however it's likely that it this method could be written more efficiently than either of these.
public boolean validLevel(double level)
ColorMap
validLevel
in interface ColorMap
public double defaultValue()
ColorMap
defaultValue
in interface ColorMap