- All Implemented Interfaces:
Serializable
,Comparable<ColorDepth>
,Constable
Enumeration providing definitions for common color depths used by various
raster image formats (pixmaps).
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescription -
Method Summary
Modifier and TypeMethodDescriptionint
The number of bits for the "alpha" portion.int
getBits()
The overall number of bits per pixel.int
The number of bits for the "blue" portion.int
getBytes()
Returns the number of bytes required to store the color value.int
The number of bits for the "green" portion.int
The max value of for the "alpha" portion.int
The max value of for the "blue" portion.int
The max value of for the "green" portion.int
The max value of for the "red" portion.int
The overall max value of per pixel.int
The number of bits for the "red" portion.boolean
Specifies whether theColorDepth
has neither RGB nor ALPHA portions.int
toAlphaValue
(int aColorValue) Retrieves the value of the alpha portion for the provided color value (being of the currentColorDepth
format).int
toBlueValue
(int aColorValue) Retrieves the value of the blue portion for the provided color value (being of the currentColorDepth
format).int
toColor
(int aColor, ColorDepth aColorDepth) Converts a color from one color depth to another color depth.int
toGreenValue
(int aColorValue) Retrieves the value of the green portion for the provided color value (being of the currentColorDepth
format).int
toRedValue
(int aColorValue) Retrieves the value of the red portion for the provided color value (being of the currentColorDepth
format).static ColorDepth
Returns the enum constant of this class with the specified name.static ColorDepth[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
MONOCHROME_1_BIT
-
GRAYSCALE_8_BIT
-
MSX_8_BIT
-
HIGH_COLOR_16_BIT
-
TRUE_COLOR_24_BIT
-
AWT_COLOR_24_BIT
-
TRUE_COLOR_32_BIT
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
getBits
public int getBits()The overall number of bits per pixel.- Returns:
- the bits
-
getBytes
public int getBytes()Returns the number of bytes required to store the color value. ForColorDepth
values with less than 8 bits per color, 1 will be returned, although a byte may contain more than one color. E.g.MONOCHROME_1_BIT
can store up to 8 color per byte!- Returns:
- The number of bytes for the color value.
-
getRedBits
public int getRedBits()The number of bits for the "red" portion.- Returns:
- the red
-
getGreenBits
public int getGreenBits()The number of bits for the "green" portion.- Returns:
- the green
-
getBlueBits
public int getBlueBits()The number of bits for the "blue" portion.- Returns:
- the blue
-
getAlphaBits
public int getAlphaBits()The number of bits for the "alpha" portion.- Returns:
- the alpha
-
getMaxValue
public int getMaxValue()The overall max value of per pixel.- Returns:
- the max value for
-
getMaxRedValue
public int getMaxRedValue()The max value of for the "red" portion.- Returns:
- the max value for red
-
getMaxGreenValue
public int getMaxGreenValue()The max value of for the "green" portion.- Returns:
- the max value for green
-
getMaxBlueValue
public int getMaxBlueValue()The max value of for the "blue" portion.- Returns:
- the max value for blue
-
getMaxAlphaValue
public int getMaxAlphaValue()The max value of for the "alpha" portion.- Returns:
- the max value for alpha
-
isMonochrome
public boolean isMonochrome()Specifies whether theColorDepth
has neither RGB nor ALPHA portions. The color just specifies the brightness (in terms of greay scale or monochrome).- Returns:
- The in case the color dies not have any RGB nor ALPHA portions!
-
toAlphaValue
public int toAlphaValue(int aColorValue) Retrieves the value of the alpha portion for the provided color value (being of the currentColorDepth
format).- Parameters:
aColorValue
- A color value of the currentColorDepth
format- Returns:
- The according alpha portion.
-
toRedValue
public int toRedValue(int aColorValue) Retrieves the value of the red portion for the provided color value (being of the currentColorDepth
format).- Parameters:
aColorValue
- A color value of the currentColorDepth
format- Returns:
- The according red portion.
-
toGreenValue
public int toGreenValue(int aColorValue) Retrieves the value of the green portion for the provided color value (being of the currentColorDepth
format).- Parameters:
aColorValue
- A color value of the currentColorDepth
format- Returns:
- The according green portion.
-
toBlueValue
public int toBlueValue(int aColorValue) Retrieves the value of the blue portion for the provided color value (being of the currentColorDepth
format).- Parameters:
aColorValue
- A color value of the currentColorDepth
format- Returns:
- The according blue portion.
-
toColor
Converts a color from one color depth to another color depth.- Parameters:
aColor
- The color to be converted.aColorDepth
- TheColorDepth
of the proided color.- Returns:
- The converted color.
-