Package ubic.basecode.graphics
Class ColorMap
java.lang.Object
ubic.basecode.graphics.ColorMap
- Author:
- Will Braynen
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Color[]
createColorPalette
(int suggestedNumberOfColors, Color[] colorMap) Allocates colors across a range.getColor
(int i) Color[]
int
protected int
getStepSize
(int minColor, int maxColor, int totalColors) Calculate how fast we have to change color components.
-
Field Details
-
DARK_RED
-
BLACKBODY_COLORMAP
-
GREENRED_COLORMAP
-
m_defaultSuggestedNumberOfColors
public static final int m_defaultSuggestedNumberOfColors- See Also:
-
REDGREEN_COLORMAP
-
m_colorPalette
-
m_currentColorMap
-
m_customColorMap
-
m_maxColor
last color in the current color map -
m_minColor
first color in the current color map
-
-
Constructor Details
-
ColorMap
public ColorMap() -
ColorMap
-
ColorMap
public ColorMap(int suggestedNumberOfColors) -
ColorMap
Pre-condition: suggestedNumberOfColors > colorMap.length- Parameters:
suggestedNumberOfColors
- intcolorMap
- Color[]
-
-
Method Details
-
getColor
-
getPalette
-
getPaletteSize
public int getPaletteSize()- Returns:
- the number of colors in the palette
-
createColorPalette
Allocates colors across a range.- Parameters:
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.- Returns:
- Color[] the color palette
-
getStepSize
protected int getStepSize(int minColor, int maxColor, int totalColors) Calculate how fast we have to change color components. Assume min and max colors are different!- Parameters:
minColor
- red, green, or blue component of the RGB colormaxColor
- red, green, or blue component of the RGB colortotalColors
- int- Returns:
- positive or negative step size
-