Klasse RGBA

java.lang.Object
info.u_team.u_team_core.util.RGBA

public class RGBA extends Object
Basic rgba representation of a color with some conversion methods
  • Feldübersicht

    Felder
    Modifizierer und Typ
    Feld
    Beschreibung
    static final RGBA
     
    static final RGBA
     
  • Konstruktorübersicht

    Konstruktoren
    Konstruktor
    Beschreibung
    RGBA(float red, float green, float blue, float alpha)
    Creates a new RGBA object from the color components in range from 0 to 1 floats.
    RGBA(int color)
    Creates a new RGBA object from a color integer
    RGBA(int red, int green, int blue, int alpha)
    Creates a new RGBA object from the color components in range from 0 to 255 integers.
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    static RGBA
    fromARGB(int color)
    Returns an RGBA object from an argb integer.
    static RGBA
    fromRGB(RGB rgb)
    Returns an RGBA object from an RGB object with 255 alpha value
    static RGBA
    fromRGB(RGB rgb, int alpha)
    Returns an RGBA object from an RGB object with a specific alpha value
    int
    Get alpha component in range from 0 to 255
    float
    Get alpha component in range from 0 to 1
    int
    Get blue component in range from 0 to 255
    float
    Get blue component in range from 0 to 1
    int
    Get the integer (hex) representation of this color in rgba format
    int
    Get the integer (hex) representation of this color in argb format
    int
    Get green component in range from 0 to 255
    float
    Get green component in range from 0 to 1
    int
    Get red component in range from 0 to 255
    float
    Get red component in range from 0 to 1
    setAlpha(int alpha)
    Set the alpha component in range from 0 to 255
    setAlphaComponent(float alpha)
    Set the alpha component in range from 0 to 1
    setBlue(int blue)
    Set the blue component in range from 0 to 255
    setBlueComponent(float blue)
    Set the blue component in range from 0 to 1
    setGreen(int green)
    Set the green component in range from 0 to 255
    setGreenComponent(float green)
    Set the green component in range from 0 to 1
    setRed(int red)
    Set the red component in range from 0 to 255
    setRedComponent(float red)
    Set the red component in range from 0 to 1
     

    Von Klasse geerbte Methoden java.lang.Object

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

    • BLACK

      public static final RGBA BLACK
    • WHITE

      public static final RGBA WHITE
  • Konstruktordetails

    • RGBA

      public RGBA(int color)
      Creates a new RGBA object from a color integer
      Parameter:
      color - hex code of color e.g. 0xFFFFFFFF for white
    • RGBA

      public RGBA(int red, int green, int blue, int alpha)
      Creates a new RGBA object from the color components in range from 0 to 255 integers.
      Parameter:
      red - Red component
      green - Green component
      blue - Blue component
      alpha - Alpha component
    • RGBA

      public RGBA(float red, float green, float blue, float alpha)
      Creates a new RGBA object from the color components in range from 0 to 1 floats.
      Parameter:
      red - Red component
      green - Green component
      blue - Blue component
      alpha - Alpha component
  • Methodendetails

    • getRed

      public int getRed()
      Get red component in range from 0 to 255
      Gibt zurück:
      Red component
    • getGreen

      public int getGreen()
      Get green component in range from 0 to 255
      Gibt zurück:
      Green component
    • getBlue

      public int getBlue()
      Get blue component in range from 0 to 255
      Gibt zurück:
      Blue component
    • getAlpha

      public int getAlpha()
      Get alpha component in range from 0 to 255
      Gibt zurück:
      Alpha component
    • getRedComponent

      public float getRedComponent()
      Get red component in range from 0 to 1
      Gibt zurück:
      Red component
    • getGreenComponent

      public float getGreenComponent()
      Get green component in range from 0 to 1
      Gibt zurück:
      Green component
    • getBlueComponent

      public float getBlueComponent()
      Get blue component in range from 0 to 1
      Gibt zurück:
      Blue component
    • getAlphaComponent

      public float getAlphaComponent()
      Get alpha component in range from 0 to 1
      Gibt zurück:
      Alpha component
    • getColor

      public int getColor()
      Get the integer (hex) representation of this color in rgba format
      Gibt zurück:
      Color as an integer
    • getColorARGB

      public int getColorARGB()
      Get the integer (hex) representation of this color in argb format
      Gibt zurück:
      Color as an integer
    • setRed

      public RGBA setRed(int red)
      Set the red component in range from 0 to 255
      Parameter:
      red - Red component
      Gibt zurück:
      A new RGBA instance with the red value set
    • setGreen

      public RGBA setGreen(int green)
      Set the green component in range from 0 to 255
      Parameter:
      green - Green component
      Gibt zurück:
      A new RGBA instance with the green value set
    • setBlue

      public RGBA setBlue(int blue)
      Set the blue component in range from 0 to 255
      Parameter:
      blue - Blue component
      Gibt zurück:
      A new RGBA instance with the blue value set
    • setAlpha

      public RGBA setAlpha(int alpha)
      Set the alpha component in range from 0 to 255
      Parameter:
      alpha - Alpha component
      Gibt zurück:
      A new RGBA instance with the alpha value set
    • setRedComponent

      public RGBA setRedComponent(float red)
      Set the red component in range from 0 to 1
      Parameter:
      red - Red component
      Gibt zurück:
      A new RGBA instance with the red value set
    • setGreenComponent

      public RGBA setGreenComponent(float green)
      Set the green component in range from 0 to 1
      Parameter:
      green - Green component
      Gibt zurück:
      A new RGBA instance with the green value set
    • setBlueComponent

      public RGBA setBlueComponent(float blue)
      Set the blue component in range from 0 to 1
      Parameter:
      blue - Blue component
      Gibt zurück:
      A new RGBA instance with the blue value set
    • setAlphaComponent

      public RGBA setAlphaComponent(float alpha)
      Set the alpha component in range from 0 to 1
      Parameter:
      alpha - Alpha component
      Gibt zurück:
      A new RGBA instance with the alpha value set
    • toString

      public String toString()
      Setzt außer Kraft:
      toString in Klasse Object
    • fromARGB

      public static RGBA fromARGB(int color)
      Returns an RGBA object from an argb integer. This encoding is used in many minecraft stuff
      Parameter:
      color - ARBA color
      Gibt zurück:
      RGBA object
    • fromRGB

      public static RGBA fromRGB(RGB rgb)
      Returns an RGBA object from an RGB object with 255 alpha value
      Parameter:
      rgb - RGB object
      Gibt zurück:
      RGBA object
    • fromRGB

      public static RGBA fromRGB(RGB rgb, int alpha)
      Returns an RGBA object from an RGB object with a specific alpha value
      Parameter:
      rgb - RGB object
      alpha - Alpha value between 0 and 255
      Gibt zurück:
      RGBA object