java.lang.Object
dev.lukebemish.dynamicassetgenerator.api.colors.ColorTypes

public final class ColorTypes extends Object
A collection of color encodings, with tools for converting between them.
  • Field Details

  • Method Details

    • clamp8

      @Contract(pure=true) public static int clamp8(int value)
      Returns:
      the provided value, clamped to the range [0x00, 0xFF]
    • clamp16

      @Contract(pure=true) public static int clamp16(int value)
      Returns:
      the provided value, clamped to the range [0x0000, 0xFFFF]
    • linearize8

      @Contract(pure=true) public static double linearize8(int value)
      Returns:
      the provided 8-bit channel of an sRGB color in linearized form
    • delinearize8

      @Contract(pure=true) public static int delinearize8(double value)
      Returns:
      the provided 8-bit channel of a linear RGB color in sRGB form
    • linearize16

      @Contract(pure=true) public static double linearize16(int value)
      Returns:
      the provided 16-bit channel of an sRGB color in linearized form
    • delinearize16

      @Contract(pure=true) public static int delinearize16(double value)
      Returns:
      the provided 16-bit channel of a linear RGB color in sRGB form
    • demote

      @Contract(pure=true) public static int demote(long color)
      Returns:
      the closest 32-bit approximation of the provided 64-bit color
    • promote

      @Contract(pure=true) public static long promote(int color)
      Returns:
      a 64-bit approximation of the provided 32-bit color