|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.mines.jtk.awt.ColorMap
public class ColorMap
A color map converts a range of double values to colors. For any double value, a color map (1) transforms the value to an integer pixel in the range [0,255], (2) maps this integer pixel to a color using an index color model.
The method getIndex(double) performs step (1). For any
double value, that method
(1a) clips to a specified min-max range of values,
(1b) linearly translates and scales to [0.0,255.0], and
(1c) rounds to the nearest integer pixel in [0,255].
Extensions of this class may of course override this method to
implement alternative mappings.
A color map maintains a list of color map listeners, and notifies those listeners whenever its mapping from values to colors has changed.
| Field Summary | |
|---|---|
static java.awt.image.IndexColorModel |
GRAY
Color model for grays from black to white. |
static java.awt.image.IndexColorModel |
HUE
Color model for hues from red to blue. |
static java.awt.image.IndexColorModel |
HUE_BLUE_TO_RED
Color model for hues from blue to red. |
static java.awt.image.IndexColorModel |
HUE_RED_TO_BLUE
Color model for hues from red to blue. |
static java.awt.image.IndexColorModel |
JET
Color model for red to blue like Matlab's jet color map. |
static java.awt.image.IndexColorModel |
PRISM
Color model for eight complete cycles of hues. |
static java.awt.image.IndexColorModel |
RED_WHITE_BLUE
Color model for red to white to blue. |
| Constructor Summary | |
|---|---|
ColorMap(double vmin,
double vmax,
byte[] r,
byte[] g,
byte[] b)
Constructs a color map for specified values and colors. |
|
ColorMap(double vmin,
double vmax,
java.awt.Color[] c)
Constructs a color map for specified values and colors. |
|
ColorMap(double vmin,
double vmax,
float[] r,
float[] g,
float[] b)
Constructs a color map for specified values and colors. |
|
ColorMap(double vmin,
double vmax,
java.awt.image.IndexColorModel colorModel)
Constructs a color map for specified values and index color model. |
|
ColorMap(java.awt.image.IndexColorModel colorModel)
Constructs a color map for values in [0,1] the index color model. |
|
| Method Summary | |
|---|---|
void |
addListener(ColorMapListener cml)
Adds the specified color map listener. |
java.awt.Color |
getColor(double v)
Gets the color corresponding to the specified value. |
java.awt.image.IndexColorModel |
getColorModel()
Gets the index color model used by this color map. |
static java.awt.image.IndexColorModel |
getGray()
Gets a linear gray black-to-white color model. |
static java.awt.image.IndexColorModel |
getGray(double g0,
double g255)
Gets a linear gray color model for the specified gray levels. |
static java.awt.image.IndexColorModel |
getGray(double g0,
double g255,
double alpha)
Gets a linear gray color model for the specified gray levels. |
static java.awt.image.IndexColorModel |
getHue()
Gets a red-to-blue linear hue color model. |
static java.awt.image.IndexColorModel |
getHue(double h0,
double h255)
Gets a linear hue color model for the specified hues. |
static java.awt.image.IndexColorModel |
getHueBlueToRed()
Gets a blue-to-red linear hue color model. |
static java.awt.image.IndexColorModel |
getHueRedToBlue()
Gets a red-to-blue linear hue color model. |
int |
getIndex(double v)
Gets the index in the range [0,255] corresponding to the specified value. |
static java.awt.image.IndexColorModel |
getJet()
Gets a red-to-blue color model like Matlab's jet color map. |
static java.awt.image.IndexColorModel |
getJet(double alpha)
Gets a red-to-blue color model like Matlab's jet color map. |
double |
getMaxValue()
Gets the maximum value in the range of mapped values. |
double |
getMinValue()
Gets the minimum value in the range of mapped values. |
static java.awt.image.IndexColorModel |
getPrism()
Gets a color model with eight complete cycles of hues. |
static java.awt.image.IndexColorModel |
getRedWhiteBlue()
Gets a red-white-blue color model. |
static java.awt.image.IndexColorModel |
makeIndexColorModel(java.awt.Color[] c)
Returns an index color model for the specified array of 256 colors. |
void |
removeListener(ColorMapListener cml)
Removes the specified color map listener. |
void |
setColorModel(java.awt.image.IndexColorModel colorModel)
Sets the index color model for this color map. |
void |
setValueRange(double vmin,
double vmax)
Sets the min-max range of values mapped to colors. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.awt.image.IndexColorModel GRAY
public static final java.awt.image.IndexColorModel JET
public static final java.awt.image.IndexColorModel HUE
public static final java.awt.image.IndexColorModel HUE_RED_TO_BLUE
public static final java.awt.image.IndexColorModel HUE_BLUE_TO_RED
public static final java.awt.image.IndexColorModel PRISM
public static final java.awt.image.IndexColorModel RED_WHITE_BLUE
| Constructor Detail |
|---|
public ColorMap(java.awt.image.IndexColorModel colorModel)
colorModel - the index color model.
public ColorMap(double vmin,
double vmax,
java.awt.image.IndexColorModel colorModel)
vmin - the minimum value.vmax - the maximum value.colorModel - the index color model.
public ColorMap(double vmin,
double vmax,
java.awt.Color[] c)
vmin - the minimum value.vmax - the maximum value.c - array[256] of colors.
public ColorMap(double vmin,
double vmax,
byte[] r,
byte[] g,
byte[] b)
vmin - the minimum value.vmax - the maximum value.r - array[256] of reds.g - array[256] of greens.b - array[256] of blues.
public ColorMap(double vmin,
double vmax,
float[] r,
float[] g,
float[] b)
vmin - the minimum value.vmax - the maximum value.r - array[256] of reds.g - array[256] of greens.b - array[256] of blues.| Method Detail |
|---|
public double getMinValue()
public double getMaxValue()
public java.awt.image.IndexColorModel getColorModel()
public java.awt.Color getColor(double v)
v - the value to be mapped to a color.
public int getIndex(double v)
v - the value to be mapped to an index.
public void setValueRange(double vmin,
double vmax)
vmin - the minimum value.vmax - the maximum value.public void setColorModel(java.awt.image.IndexColorModel colorModel)
colorModel - the index color model.public void addListener(ColorMapListener cml)
cml - the listener.public void removeListener(ColorMapListener cml)
cml - the listener.public static java.awt.image.IndexColorModel getGray()
public static java.awt.image.IndexColorModel getGray(double g0,
double g255)
g0 - the gray level corresponding to index value 0.g255 - the gray level corresponding to index value 255.
public static java.awt.image.IndexColorModel getGray(double g0,
double g255,
double alpha)
g0 - the gray level corresponding to index value 0.g255 - the gray level corresponding to index value 255.alpha - the opacity for all colors in this color model.
public static java.awt.image.IndexColorModel getJet()
public static java.awt.image.IndexColorModel getJet(double alpha)
alpha - the opacity for all colors in this color model.
public static java.awt.image.IndexColorModel getPrism()
public static java.awt.image.IndexColorModel getHue()
public static java.awt.image.IndexColorModel getHueRedToBlue()
public static java.awt.image.IndexColorModel getHueBlueToRed()
public static java.awt.image.IndexColorModel getHue(double h0,
double h255)
h0 - the hue corresponding to index value 0.h255 - the hue corresponding to index value 255.
public static java.awt.image.IndexColorModel getRedWhiteBlue()
public static java.awt.image.IndexColorModel makeIndexColorModel(java.awt.Color[] c)
c - array[256] of colors.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||