Record Class Color

java.lang.Object
java.lang.Record
dev.latvian.mods.klib.color.Color
All Implemented Interfaces:
Gradient

public record Color(int argb) extends Record implements Gradient
  • Field Details

    • EMPTY_ARRAY

      public static final Color[] EMPTY_ARRAY
    • TRANSPARENT

      public static final Color TRANSPARENT
    • WHITE

      public static final Color WHITE
    • BLACK

      public static final Color BLACK
    • RED

      public static final Color RED
    • GREEN

      public static final Color GREEN
    • BLUE

      public static final Color BLUE
    • YELLOW

      public static final Color YELLOW
    • MAGENTA

      public static final Color MAGENTA
    • CYAN

      public static final Color CYAN
    • STRING_CODEC

      public static final com.mojang.serialization.Codec<Color> STRING_CODEC
    • INT_CODEC

      public static final com.mojang.serialization.Codec<Color> INT_CODEC
    • SOLID_INT_CODEC

      public static final com.mojang.serialization.Codec<Color> SOLID_INT_CODEC
    • CODEC

      public static final com.mojang.serialization.Codec<Color> CODEC
    • SOLID_CODEC

      public static final com.mojang.serialization.Codec<Color> SOLID_CODEC
    • TO_INT_CODEC

      public static final com.mojang.serialization.Codec<Color> TO_INT_CODEC
    • SOLID_TO_INT_CODEC

      public static final com.mojang.serialization.Codec<Color> SOLID_TO_INT_CODEC
    • STREAM_CODEC

      public static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf,Color> STREAM_CODEC
    • SOLID_STREAM_CODEC

      public static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf,Color> SOLID_STREAM_CODEC
    • DATA_TYPE

      public static final DataType<Color> DATA_TYPE
    • SOLID_DATA_TYPE

      public static final DataType<Color> SOLID_DATA_TYPE
  • Constructor Details

    • Color

      public Color(int argb)
      Creates an instance of a Color record class.
      Parameters:
      argb - the value for the argb record component
  • Method Details

    • of

      public static Color of(int argb)
    • ofRGB

      public static Color ofRGB(int rgb)
    • of

      public static Color of(int a, int r, int g, int b)
    • of

      public static Color of(int r, int g, int b)
    • of

      public static Color of(float a, float r, float g, float b)
    • hsb

      public static Color hsb(float hue, float saturation, float brightness, int alpha)
    • rgb

      public int rgb()
    • alpha

      public int alpha()
    • red

      public int red()
    • green

      public int green()
    • blue

      public int blue()
    • alphaf

      public float alphaf()
    • redf

      public float redf()
    • greenf

      public float greenf()
    • bluef

      public float bluef()
    • withAlpha

      public Color withAlpha(int alpha)
    • withAlpha

      public Color withAlpha(float alpha)
    • mixAlpha

      public Color mixAlpha(int alpha)
    • mixAlpha

      public Color mixAlpha(float alpha)
    • fadeOut

      public Color fadeOut(float time, float maxTime, float fadeOut)
    • hashCode

      public int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • toRGBString

      public String toRGBString()
    • toARGBString

      public String toARGBString()
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • lerp

      public Color lerp(float delta, Color other, int alpha)
    • lerp

      public Color lerp(float delta, Color other)
    • get

      public Color get(float delta)
      Specified by:
      get in interface Gradient
    • isTransparent

      public boolean isTransparent()
    • solid

      public Color solid()
    • transparent

      public Color transparent()
    • toOptionalARGB

      public OptionalInt toOptionalARGB()
    • toOptionalRGB

      public OptionalInt toOptionalRGB()
    • abgr

      public int abgr()
    • getHue

      public float getHue()
    • toHSB

      public float[] toHSB(float[] hsb)
    • optimize

      public Color optimize()
      Specified by:
      optimize in interface Gradient
    • getPositionedColors

      public List<PositionedColor> getPositionedColors()
      Specified by:
      getPositionedColors in interface Gradient
    • gradient

      public Gradient gradient(Color other)
    • gradient

      public Gradient gradient(Color other, Interpolation interpolation)
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • argb

      public int argb()
      Returns the value of the argb record component.
      Returns:
      the value of the argb record component