Package info.u_team.u_team_core.util
Klasse RGB
java.lang.Object
info.u_team.u_team_core.util.RGB
Basic rgb representation of a color with some conversion methods
-
Feldübersicht
Felder -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungRGB(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 integerRGB(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 TypMethodeBeschreibungstatic RGBintgetBlue()Get blue component in range from 0 to 255floatGet blue component in range from 0 to 1intgetColor()Get the integer (hex) representation of this color in rgb formatintgetGreen()Get green component in range from 0 to 255floatGet green component in range from 0 to 1intgetRed()Get red component in range from 0 to 255floatGet red component in range from 0 to 1setBlue(int blue) Set the blue component in range from 0 to 255setBlueComponent(float blue) Set the blue component in range from 0 to 1setGreen(int green) Set the green component in range from 0 to 255setGreenComponent(float green) Set the green component in range from 0 to 1setRed(int red) Set the red component in range from 0 to 255setRedComponent(float red) Set the red component in range from 0 to 1toString()
-
Felddetails
-
BLACK
-
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 componentgreen- Green componentblue- 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 componentgreen- Green componentblue- 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
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
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
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
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
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
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
-
fromRGBA
- Parameter:
rgba- RGBA object- Gibt zurück:
- RGB object
-