Enum Class BlendMode

java.lang.Object
java.lang.Enum<BlendMode>
com.github.darksoulq.abyssallib.common.color.BlendMode
All Implemented Interfaces:
Serializable, Comparable<BlendMode>, Constable

public enum BlendMode extends Enum<BlendMode>
An enumeration of standard digital image blending modes.

These modes define the mathematical logic used to combine a base (background) color and a source (foreground) color to produce a result color.

  • Nested Class Summary

    Nested classes/interfaces inherited from class Enum

    Enum.EnumDesc<E>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Adds 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 Type
    Method
    Description
    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.
    static BlendMode
    Returns the enum constant of this class with the specified name.
    static BlendMode[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • NORMAL

      public static final BlendMode NORMAL
      Normal blending mode. The source color completely replaces the base color.

      Formula: Result = Source

    • MULTIPLY

      public static final BlendMode MULTIPLY
      Multiplies the base color by the source color. The result is always darker.

      Formula: Result = (Base * Source) / 255

    • SCREEN

      public static final BlendMode SCREEN
      Inverts both colors, multiplies them, and inverts the result. The result is always lighter.

      Formula: Result = 255 - ((255 - Base) * (255 - Source)) / 255

    • OVERLAY

      public static final BlendMode OVERLAY
      A combination of Multiply and Screen. If the base is light, it uses Screen; if the base is dark, it uses Multiply.
    • DARKEN

      public static final BlendMode DARKEN
      Selects the darker of the two colors for each channel.

      Formula: Result = min(Base, Source)

    • LIGHTEN

      public static final BlendMode LIGHTEN
      Selects the lighter of the two colors for each channel.

      Formula: Result = max(Base, Source)

    • ADD

      public static final BlendMode ADD
      Adds the source color to the base color, clamping at 255.

      Formula: Result = min(255, Base + Source)

    • SUBTRACT

      public static final BlendMode SUBTRACT
      Subtracts the source color from the base color, clamping at 0.

      Formula: Result = max(0, Base - Source)

    • DIFFERENCE

      public static final BlendMode DIFFERENCE
      Subtracts the darker color from the lighter color for each channel.

      Formula: Result = |Base - Source|

    • EXCLUSION

      public static final BlendMode EXCLUSION
      Similar to Difference but lower contrast.

      Formula: Result = Base + Source - (2 * Base * Source / 255)

    • AVERAGE

      public static final BlendMode AVERAGE
      Calculates the mathematical average of the two colors.

      Formula: Result = (Base + Source) / 2

  • Method Details

    • values

      public static BlendMode[] 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

      public static BlendMode valueOf(String name)
      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 name
      NullPointerException - 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.