Record Class Color

java.lang.Object
java.lang.Record
dev.pfaff.altargui.types.Color

public record Color(int rgba) extends Record
A type representing an RGBA color with 8-bit channels.

Until value classes are available for use, avoid storing instances except in static final or other long-lived fields.

  • Field Details

    • WHITE

      public static Color WHITE
    • TRANSPARENT

      public static Color TRANSPARENT
  • Constructor Details

    • Color

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

    • fromRgba

      public static Color fromRgba(int rgba)
    • fromRgba

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

      public static Color fromRgb(int rgb)
    • fromRgb

      public static Color fromRgb(int r, int g, int b)
    • fromArgb

      public static Color fromArgb(int argb)
    • argb

      public int argb()
      Returns the colorRgba in ARGB format.
    • abgr

      public int abgr()
    • alpha

      public int alpha()
    • rgb

      public int rgb()
    • withAlpha

      public Color withAlpha(int a)
    • 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
    • hashCode

      public final 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
    • 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.
    • rgba

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