Enum Class ColorBlindness
- All Implemented Interfaces:
Serializable, Comparable<ColorBlindness>, Constable
An enumeration representing various types of color vision deficiencies (CVD).
This class provides a mathematical simulation of how different colors are perceived by individuals with specific types of color blindness. The simulation process involves:
- Linearizing the sRGB input (Gamma expansion).
- Applying a transformation matrix based on the deficiency type.
- De-linearizing the result back to sRGB (Gamma compression).
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionTotal color blindness; the inability to perceive any color.Green-blindness; the inability to perceive green light.Standard human vision with no color deficiency.Red-blindness; the inability to perceive red light.Blue-blindness; the inability to perceive blue light. -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.Colorsimulate(org.bukkit.Color c) Simulates the current color vision deficiency on a given Color.static ColorBlindnessReturns the enum constant of this class with the specified name.static ColorBlindness[]values()Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class Enum
compareTo, describeConstable, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Enum Constant Details
-
NORMAL
Standard human vision with no color deficiency. -
PROTANOPIA
Red-blindness; the inability to perceive red light. Resulting vision consists primarily of blues and yellows. -
DEUTERANOPIA
Green-blindness; the inability to perceive green light. This is the most common form of color blindness. -
TRITANOPIA
Blue-blindness; the inability to perceive blue light. A rare condition where colors are mostly seen as reds and greens. -
ACHROMATOPSIA
Total color blindness; the inability to perceive any color. Vision is restricted to shades of gray (luminance only).
-
-
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
-
simulate
public org.bukkit.Color simulate(org.bukkit.Color c) Simulates the current color vision deficiency on a given Color.The method performs gamma correction before and after the color space transformation to ensure accuracy in the linear RGB space.
- Parameters:
c- The originalColorto be transformed.- Returns:
- A new
Colorrepresenting how the input would be perceived.
-