Enum Class BlendMode
- All Implemented Interfaces:
Serializable, Comparable<BlendMode>, Constable
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionAdds the source color to the base color, clamping at 255.Calculates the mathematical average of the two colors.Selects the darker of the two colors for each channel.Subtracts the darker color from the lighter color for each channel.Similar to Difference but lower contrast.Selects the lighter of the two colors for each channel.Multiplies the base color by the source color.Normal blending mode.A combination of Multiply and Screen.Inverts both colors, multiplies them, and inverts the result.Subtracts the source color from the base color, clamping at 0. -
Method Summary
Modifier and TypeMethodDescriptionabstract org.bukkit.Colorblend(org.bukkit.Color base, org.bukkit.Color source) Blends a source color into a base color using this specific mode's logic.static BlendModeReturns the enum constant of this class with the specified name.static BlendMode[]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
Normal blending mode. The source color completely replaces the base color.Formula:
Result = Source -
MULTIPLY
Multiplies the base color by the source color. The result is always darker.Formula:
Result = (Base * Source) / 255 -
SCREEN
Inverts both colors, multiplies them, and inverts the result. The result is always lighter.Formula:
Result = 255 - ((255 - Base) * (255 - Source)) / 255 -
OVERLAY
A combination of Multiply and Screen. If the base is light, it uses Screen; if the base is dark, it uses Multiply. -
DARKEN
Selects the darker of the two colors for each channel.Formula:
Result = min(Base, Source) -
LIGHTEN
Selects the lighter of the two colors for each channel.Formula:
Result = max(Base, Source) -
ADD
Adds the source color to the base color, clamping at 255.Formula:
Result = min(255, Base + Source) -
SUBTRACT
Subtracts the source color from the base color, clamping at 0.Formula:
Result = max(0, Base - Source) -
DIFFERENCE
Subtracts the darker color from the lighter color for each channel.Formula:
Result = |Base - Source| -
EXCLUSION
Similar to Difference but lower contrast.Formula:
Result = Base + Source - (2 * Base * Source / 255) -
AVERAGE
Calculates the mathematical average of the two colors.Formula:
Result = (Base + Source) / 2
-
-
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
-
blend
public abstract org.bukkit.Color blend(org.bukkit.Color base, org.bukkit.Color source) Blends a source color into a base color using this specific mode's logic.- Parameters:
base- The background color.source- The foreground/overlay color.- Returns:
- The resulting blended
Color.
-