Klasse RGB

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

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

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

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

    Modifizierer und Typ
    Methode
    Beschreibung
    static RGB
    fromRGBA(RGBA rgba)
    Returns an RGB object from an RGBA object.
    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 rgb 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
    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 RGB BLACK
    • WHITE

      public static final RGB WHITE
  • Konstruktordetails

    • RGB

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

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

      public RGB(float red, float green, float blue)
      Creates a new RGB object from the color components in range from 0 to 1 floats.
      Parameter:
      red - Red component
      green - Green component
      blue - Blue 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
    • 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
    • getColor

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

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

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

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

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

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

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

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

      public static RGB fromRGBA(RGBA rgba)
      Returns an RGB object from an RGBA object. Alpha value is lost in that conversion.
      Parameter:
      rgba - RGBA object
      Gibt zurück:
      RGB object