public class TestPalette extends Object
| Constructor and Description |
|---|
TestPalette()
Default constructor using the blue to yellow palette.
|
TestPalette(String name,
float[][] rgb)
Construct a palette colorizer using the palette specified as
an array of red/green/blue values in the range 0 to 255.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getARGB(double z,
double zMin,
double zMax)
Assigns a color value in the ARGB system to a z value based
on its position within a range of values and the palette associated
with this instance.
|
static TestPalette |
getBlueToYellowPalette()
Gets an instance of the palette colorizer using
the blue-to-yellow palette.
|
Color |
getColor(double z,
double zMin,
double zMax)
Assigns a Color object to a z value based
on its position within a range of values and the palette associated
with this instance.
|
static TestPalette |
getDefaultPalette()
Gets an instance of the palette colorizer using
the default palette.
|
static Icon |
getIconByName(String name,
int width,
int height)
Gets an icon depicting the palette for User Interface purposes.
|
static TestPalette |
getLinearGrayPalette()
Constructs an instance of the palette colorizer using
the a linear interpolation of values in the RGB color space.
|
String |
getName()
Gets the name of the palette
|
static TestPalette |
getPaletteByName(String paletteName)
Gets the palette specified by name
|
static List<String> |
getPaletteNames()
Gets a list of the names of palettes defined by this class.
|
static TestPalette |
getPurpleTonesPalette()
Gets an instance of the palette colorizer using
the purple-tones palette.
|
static TestPalette |
getRainbowPalette()
Constructs an instance of the palette colorizer using
the rainbow palette.
|
static TestPalette |
getRedToYellowToWhitePalette()
Constructs an instance of the palette colorizer using
the red-to-yellow-to-white palette.
|
static void |
loadRecipiesFromStream(InputStream ins,
boolean flip) |
public TestPalette(String name, float[][] rgb)
name - the name of the palette (null if not used)rgb - an n by 3 array of rgb values.public TestPalette()
public static TestPalette getBlueToYellowPalette()
public static TestPalette getDefaultPalette()
public static TestPalette getPurpleTonesPalette()
public static TestPalette getRedToYellowToWhitePalette()
public static TestPalette getRainbowPalette()
public static TestPalette getLinearGrayPalette()
public int getARGB(double z,
double zMin,
double zMax)
The alpha channel value (high-order byte) for the return is always set to fully opaque for valid inputs. If given a undefined input value (Double.NaN), a zero (fully transparent) value will be returned. If given a z value outside the specified region, its value will be constrained as necessary.
z - the z value of interestzMin - the value associated with the minimum-index color
in the palette.zMax - the value associated with the maximum-index color
in the palette.public Color getColor(double z, double zMin, double zMax)
The alpha channel value (high-order byte) for the return is always set to fully opaque for valid inputs. If given a undefined input value (Double.NaN), a zero (fully transparent) value will be returned. If given a z value outside the specified region, its value will be constrained as necessary.
z - the z value of interestzMin - the value associated with the minimum-index color
in the palette.zMax - the value associated with the maximum-index color
in the palette.public static TestPalette getPaletteByName(String paletteName)
paletteName - a valid string matching one a named palette
defined by this class.public static List<String> getPaletteNames()
public String getName()
public static Icon getIconByName(String name, int width, int height)
name - the name of the palettewidth - the width of the iconheight - the height of the iconpublic static void loadRecipiesFromStream(InputStream ins, boolean flip) throws IOException, NumberFormatException
IOExceptionNumberFormatExceptionCopyright © 2019. All rights reserved.