public class ColorMap extends Object
Modifier and Type | Field and Description |
---|---|
static Color[] |
BLACKBODY_COLORMAP |
static Color |
DARK_RED |
static Color[] |
GREENRED_COLORMAP |
protected Color[] |
m_colorPalette |
protected Color[] |
m_currentColorMap |
protected Color[] |
m_customColorMap |
static int |
m_defaultSuggestedNumberOfColors |
protected Color |
m_maxColor
last color in the current color map
|
protected Color |
m_minColor
first color in the current color map
|
static Color[] |
REDGREEN_COLORMAP |
Constructor and Description |
---|
ColorMap() |
ColorMap(Color[] colorMap) |
ColorMap(int suggestedNumberOfColors) |
ColorMap(int suggestedNumberOfColors,
Color[] colorMap)
Pre-condition: suggestedNumberOfColors > colorMap.length
|
Modifier and Type | Method and Description |
---|---|
protected Color[] |
createColorPalette(int suggestedNumberOfColors,
Color[] colorMap)
Allocates colors across a range.
|
Color |
getColor(int i) |
Color[] |
getPalette() |
int |
getPaletteSize() |
protected int |
getStepSize(int minColor,
int maxColor,
int totalColors)
Calculate how fast we have to change color components.
|
public static final Color DARK_RED
public static final Color[] BLACKBODY_COLORMAP
public static final Color[] GREENRED_COLORMAP
public static final int m_defaultSuggestedNumberOfColors
public static final Color[] REDGREEN_COLORMAP
protected Color[] m_colorPalette
protected Color[] m_currentColorMap
protected Color[] m_customColorMap
protected Color m_maxColor
protected Color m_minColor
public ColorMap()
public ColorMap(Color[] colorMap)
public ColorMap(int suggestedNumberOfColors)
public ColorMap(int suggestedNumberOfColors, Color[] colorMap)
suggestedNumberOfColors
- intcolorMap
- Color[]public Color getColor(int i)
public Color[] getPalette()
public int getPaletteSize()
protected Color[] createColorPalette(int suggestedNumberOfColors, Color[] colorMap)
suggestedNumberOfColors
- palette resolution; if colorPalette.length does not evenly divide into this
number, the actual number of colors in the palette will be rounded down.colorMap
- the simplest color map is { minColor, maxColor }; you might, however, want to go through
intermediate colors instead of following a straight-line route through the color space.protected int getStepSize(int minColor, int maxColor, int totalColors)
minColor
- red, green, or blue component of the RGB colormaxColor
- red, green, or blue component of the RGB colortotalColors
- intCopyright © 2003–2023 UBC Michael Smith Laboratories. All rights reserved.