Klasse ColorRGBA

java.lang.Object
net.risingworld.api.utils.ColorRGBA
Alle implementierten Schnittstellen:
Serializable

public class ColorRGBA extends Object implements Serializable
Represents a color consisting of a red, green and blue component (linear color space) as well as an alpha component (for transparency/opacity).
Siehe auch:
  • Feldübersicht

    Felder
    Modifizierer und Typ
    Feld
    Beschreibung
    float
    The alpha (opacity) color component (0-1)
    float
    The blue color component (0-1)
    static final ColorRGBA
    Black color (0, 0, 0)
    static final ColorRGBA
    Blue color (0, 0, 1)
    static final ColorRGBA
    Black color with no alpha (0, 0, 0)
    float
    The green color component (0-1)
    static final ColorRGBA
    Green color (0, 1, 0)
    static final ColorRGBA
    Grey color (0.5, 0.5, 0.5)
    float
    The red color component (0-1)
    static final ColorRGBA
    Red color (1, 0, 0)
    static final ColorRGBA
    White color (1, 1, 1)
  • Konstruktorübersicht

    Konstruktoren
    Konstruktor
    Beschreibung
    Creates a new white color (all values 1)
    ColorRGBA(float r, float g, float b, float a)
    Creates a new color with the provided values.
    ColorRGBA(int rgba)
     
    Creates a new color and copies the values from the provided color.
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    boolean
    equals(float r, float g, float b, float a)
     
    boolean
    Gets whether or not this color is equal to another object.
    fromIntRGBA(int rgba)
     
    int
     
    interpolateLocal(ColorRGBA color, float mu)
    Interpolates this color to the provided final color, e.g if this color is (0, 0, 1, 1), and the final color is (1, 0.5f, 0, 1), the result (by using a mu-value of 0.5f) would be (0.5f, 0.25f, 0.5f, 1)
    set(float r, float g, float b, float a)
    Sets the r, g, b and a values of this color to the provided values.
    set(ColorRGBA color)
    Sets the r, g, b and a values of this color to the values of the provided color.
    int
    Converts the color r, g, b and a values to an int representation.
    Gets a String representation of this color, for example (1.0, 0.5, 0.0, 1.0)
     

    Von Klasse geerbte Methoden java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Felddetails

    • White

      public static final ColorRGBA White
      White color (1, 1, 1)
    • Grey

      public static final ColorRGBA Grey
      Grey color (0.5, 0.5, 0.5)
    • Black

      public static final ColorRGBA Black
      Black color (0, 0, 0)
    • Clear

      public static final ColorRGBA Clear
      Black color with no alpha (0, 0, 0)
    • Red

      public static final ColorRGBA Red
      Red color (1, 0, 0)
    • Green

      public static final ColorRGBA Green
      Green color (0, 1, 0)
    • Blue

      public static final ColorRGBA Blue
      Blue color (0, 0, 1)
    • r

      public float r
      The red color component (0-1)
    • g

      public float g
      The green color component (0-1)
    • b

      public float b
      The blue color component (0-1)
    • a

      public float a
      The alpha (opacity) color component (0-1)
  • Konstruktordetails

    • ColorRGBA

      public ColorRGBA()
      Creates a new white color (all values 1)
    • ColorRGBA

      public ColorRGBA(int rgba)
    • ColorRGBA

      public ColorRGBA(float r, float g, float b, float a)
      Creates a new color with the provided values.
      Parameter:
      r - the red color component (0-1).
      g - the green color component (0-1).
      b - the blue color component (0-1).
      a - the alpha (opacity) color component (0-1).
    • ColorRGBA

      public ColorRGBA(ColorRGBA copy)
      Creates a new color and copies the values from the provided color.
      Parameter:
      copy - the color to copy.
  • Methodendetails

    • set

      public ColorRGBA set(ColorRGBA color)
      Sets the r, g, b and a values of this color to the values of the provided color.
      Parameter:
      color - the ColorRGBA to copy.
      Gibt zurück:
      this color.
    • set

      public ColorRGBA set(float r, float g, float b, float a)
      Sets the r, g, b and a values of this color to the provided values.
      Parameter:
      r - the red color value.
      g - the green color value.
      b - the blue color value.
      a - the alpha (opacity) color value.
      Gibt zurück:
      this color.
    • interpolateLocal

      public ColorRGBA interpolateLocal(ColorRGBA color, float mu)
      Interpolates this color to the provided final color, e.g if this color is (0, 0, 1, 1), and the final color is (1, 0.5f, 0, 1), the result (by using a mu-value of 0.5f) would be (0.5f, 0.25f, 0.5f, 1)
      Parameter:
      color - the color to interpolate towards.
      mu - the mu value between 0.0 and 1.0 (i.e the percentage change from this color to towards the final color).
      Gibt zurück:
      this color containing the interpolated color values.
    • toVector4f

      public Vector4f toVector4f()
    • toIntRGBA

      public int toIntRGBA()
      Converts the color r, g, b and a values to an int representation.
      Gibt zurück:
      the integer representation of this color in rgba order.
    • fromIntRGBA

      public ColorRGBA fromIntRGBA(int rgba)
    • equals

      public boolean equals(Object o)
      Gets whether or not this color is equal to another object. This function returns true, if the other object is a ColorRGBA and if it has exactly the same r, g, b and a values.
      Setzt außer Kraft:
      equals in Klasse Object
      Parameter:
      o - the object to compare to equality.
      Gibt zurück:
      true if the other object is a ColorRGBA and has the same values as this color, false if not.
    • equals

      public boolean equals(float r, float g, float b, float a)
    • hashCode

      public int hashCode()
      Setzt außer Kraft:
      hashCode in Klasse Object
    • toString

      public String toString()
      Gets a String representation of this color, for example (1.0, 0.5, 0.0, 1.0)
      Setzt außer Kraft:
      toString in Klasse Object
      Gibt zurück:
      a string representing the values of this color.