public final class ColorUtil extends Object
Modifier and Type | Field and Description |
---|---|
static RealType |
CLEAR
RealType for indicating nothing mapped to a color component.
|
static int |
COLOR_DETAIL
Resolution of color tables.
|
static int |
COMPOSITE_MODEL
Composite RGB color space model.
|
static int |
CONSTANT_ALPHA
Constant alpha value transparency model.
|
static int |
CURVED_ALPHA
Polynomial alpha curve transparency model.
|
static int |
HSV_MODEL
HSV color space model.
|
protected static float[] |
LINEAR
Linear color table component used in several presets.
|
static float[][] |
LUT_BLUE
Blue color look-up table.
|
static float[][] |
LUT_CYAN
Cyan color look-up table.
|
static float[][] |
LUT_FIRE
Fire color look-up table.
|
static float[][] |
LUT_GRAY
Grayscale color look-up table.
|
static float[][] |
LUT_GREEN
Green color look-up table.
|
static float[][] |
LUT_HSV
HSV color look-up table.
|
static float[][] |
LUT_ICE
Ice color look-up table.
|
protected static int |
LUT_LEN
Color table file length.
|
static float[][] |
LUT_MAGENTA
Magenta color look-up table.
|
static float[][] |
LUT_RED
Red color look-up table.
|
static float[][] |
LUT_RGB
RGB (pseudocolor) color look-up table.
|
static float[][] |
LUT_YELLOW
Yellow color look-up table.
|
static int |
MAX_POWER
Maximum alpha exponent for polynomial transparency curve.
|
static int |
RGB_MODEL
RGB color space model.
|
static RealType |
SOLID
RealType for indicating uniformly solid color component.
|
protected static float[] |
ZEROED
Zeroed out color table componented used in several presets.
|
Modifier and Type | Method and Description |
---|---|
static float[][] |
adjustColorTable(float[][] table,
float[] alpha,
boolean doAlpha)
Ensures the color table is of the proper type (RGB or RGBA).
|
static String |
colorToHex(Color color)
Gets a hexidecimal representation for this color.
|
static float[] |
computeAlphaTable(int opacity,
int model)
Computes alpha table component from the given transparency settings.
|
static float[][][] |
computeColorTables(ScalarMap[] maps,
int brightness,
int contrast,
int model,
RealType red,
RealType green,
RealType blue)
Computes color tables from the given color settings.
|
static Color |
hexToColor(String hex)
Gets the corresponding Color object for this hexidecimal string.
|
static float[][] |
loadColorTable(File file)
Loads the color table from the given file.
|
static void |
reAutoScale(DisplayImpl display,
ScalarMap map)
Recomputes autoscaled color bounds for the given color map.
|
static boolean |
saveColorTable(float[][] table,
File file)
Saves the given color table into the specified file.
|
static void |
setAlphaTable(ScalarMap[] maps,
float[] alpha)
Assigns the given alpha channel to the specified mappings.
|
static void |
setColorMode(DisplayImpl display,
int model)
Sets the given display's color mode to use either averaging or sums,
depending on the specified color model.
|
static void |
setColorRange(DisplayImpl display,
ScalarMap map,
double lo,
double hi,
boolean fixed)
Assigns the given color range to the specified display and mapping.
|
static void |
setColorRanges(DisplayImpl display,
ScalarMap[] maps,
double[] lo,
double[] hi,
boolean[] fixed)
Assigns the given color ranges to the specified display and mappings.
|
static void |
setColorTables(ScalarMap[] maps,
float[][][] tables)
Assigns the given color tables to the specified mappings.
|
public static final int COLOR_DETAIL
public static final int MAX_POWER
protected static final float[] ZEROED
protected static final float[] LINEAR
public static final float[][] LUT_GRAY
public static final float[][] LUT_RED
public static final float[][] LUT_GREEN
public static final float[][] LUT_BLUE
public static final float[][] LUT_CYAN
public static final float[][] LUT_MAGENTA
public static final float[][] LUT_YELLOW
public static final float[][] LUT_HSV
public static final float[][] LUT_RGB
public static final float[][] LUT_FIRE
public static final float[][] LUT_ICE
public static final int RGB_MODEL
public static final int HSV_MODEL
public static final int COMPOSITE_MODEL
public static final int CONSTANT_ALPHA
public static final int CURVED_ALPHA
public static final RealType CLEAR
public static final RealType SOLID
protected static final int LUT_LEN
public static float[][][] computeColorTables(ScalarMap[] maps, int brightness, int contrast, int model, RealType red, RealType green, RealType blue)
maps
- ScalarMaps for which to generate color tablesbrightness
- Brightness value from 0 to 255.contrast
- Contrast value from 0 to 255.model
- Color space model: RGB_MODEL, HSV_MODEL or COMPOSITE_MODELred
- RealType to map to red color componentgreen
- RealType to map to green color componentblue
- RealType to map to blue color componentpublic static float[] computeAlphaTable(int opacity, int model)
opacity
- Level of solidity, from 0 to COLOR_DETAILmodel
- Transparency model: CONSTANT_ALPHA or CURVED_ALPHApublic static void setColorRange(DisplayImpl display, ScalarMap map, double lo, double hi, boolean fixed)
public static void setColorRanges(DisplayImpl display, ScalarMap[] maps, double[] lo, double[] hi, boolean[] fixed)
public static void reAutoScale(DisplayImpl display, ScalarMap map)
public static void setColorTables(ScalarMap[] maps, float[][][] tables)
public static void setAlphaTable(ScalarMap[] maps, float[] alpha)
public static float[][] adjustColorTable(float[][] table, float[] alpha, boolean doAlpha)
public static void setColorMode(DisplayImpl display, int model)
public static float[][] loadColorTable(File file)
public static boolean saveColorTable(float[][] table, File file)
public static String colorToHex(Color color)
public static Color hexToColor(String hex) throws NumberFormatException
NumberFormatException
Copyright © 2015–2022 SciJava. All rights reserved.