public enum ColorPalette extends java.lang.Enum<ColorPalette>
Enum Constant and Description |
---|
BLACK |
BLUE |
BROWN |
CYAN |
DARK_BLUE |
DARK_GRAY |
DARK_GREEN |
DARK_MAGENTA |
DARK_RED |
DRAK_CYAN |
GRAY |
GREEN |
MAGENTA |
RED |
WHITE |
YELLOW |
Modifier and Type | Field and Description |
---|---|
private int |
b
Blue.
|
private static int[] |
colorIndexes
Conversion table palette index to color number
|
private int |
g
Green.
|
private int |
index
Color number (index in COLOR-TABLE)
|
private static int[] |
paletteIndexes
Conversion table color number to palette index
|
private int |
r
Red.
|
Modifier and Type | Method and Description |
---|---|
static int |
colorToPalette(int color)
Convert color number to palette index.
|
int |
getBlue()
Get the blue component of this color.
|
int |
getGreen()
Get the green component of this color.
|
int |
getIndex()
Get color index number in COLOR-TABLE.
|
int |
getRed()
Get the red component of this color.
|
static int |
paletteToColor(int index)
Convert color number to palette index.
|
static ColorPalette |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static ColorPalette[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final ColorPalette BLACK
public static final ColorPalette RED
public static final ColorPalette GREEN
public static final ColorPalette YELLOW
public static final ColorPalette BLUE
public static final ColorPalette MAGENTA
public static final ColorPalette CYAN
public static final ColorPalette WHITE
public static final ColorPalette DARK_RED
public static final ColorPalette DARK_GREEN
public static final ColorPalette BROWN
public static final ColorPalette DARK_BLUE
public static final ColorPalette DARK_MAGENTA
public static final ColorPalette DRAK_CYAN
public static final ColorPalette GRAY
public static final ColorPalette DARK_GRAY
private static int[] paletteIndexes
private static int[] colorIndexes
private int index
private int r
private int g
private int b
public static ColorPalette[] values()
for (ColorPalette c : ColorPalette.values()) System.out.println(c);
public static ColorPalette valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic static int colorToPalette(int color)
color
- Color number. Must be between 0 and 15.public static int paletteToColor(int index)
index
- Palette index. Must be between 0 and 15.public int getIndex()
public int getRed()
public int getGreen()
public int getBlue()