Class GUIColor
java.lang.Object
com.blackrook.gui.GUIColor
Contains a set of values that describe a color.
- Author:
- Matthew Tropiano
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final GUIColorstatic final GUIColorstatic final GUIColorstatic final GUIColorstatic final GUIColorstatic final GUIColorstatic final GUIColorstatic final GUIColorstatic final GUIColorstatic final GUIColorstatic final GUIColorstatic final GUIColorstatic final GUIColorstatic final GUIColorstatic final GUIColorstatic final GUIColorstatic final GUIColorstatic final GUIColorstatic final GUIColorstatic final GUIColorstatic final GUIColorstatic final GUIColorstatic final GUIColorstatic final GUIColor -
Constructor Summary
ConstructorsConstructorDescriptionGUIColor()Makes a new blank Color (RGBA (0,0,0,0)).GUIColor(float red, float green, float blue) Makes a new color from channel components, with the alpha value as 1.GUIColor(float red, float green, float blue, float alpha) Makes a new color from channel components.GUIColor(int argb) Makes a new color from a 32-bit ARGB integer (like from a BufferedImage).Makes a new color from an existing color. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a color's components to this one.static voidAdds a color's components to another.voidBlends a color's component's to this one, using the incoming color's alpha channel as a blending factor.static voidalphaBlend(GUIColor a, GUIColor b, GUIColor out) Blends two colors using alpha blending.voidclamp()Clamps this color's channel values into the range 0 to 1.booleanbooleanfloatgetAlpha()intgetARGB()static intgetARGB(float red, float green, float blue, float alpha) Converts RGBA floats to an ARGB integer.floatgetBlue()floatgetGreen()floatgetRed()voidgetRGBA(float[] out) Returns this color's RGBA info into a float array.voidMultiplies a color's components to this one.static voidMultiplies a color's components to another.voidscale(float scalar) Multiplies all channels in this color by a scalar.static voidScales a color's channel values by a scalar.voidset(float red, float green, float blue, float alpha) Sets this color's info using another color.voidset(int argb) Sets this color's info using another color.voidSets this color's info using another color.voidsetAlpha(float alpha) Sets the alpha component, commonly used for blending operations.voidsetBlue(float blue) Sets the blue component.voidsetGreen(float green) Sets the green component.voidsetRed(float red) Sets the red component.voidSubtracts a color's components from this one.static voidSubtracts a color's components from another.
-
Field Details
-
WHITE
-
LIGHT_GRAY
-
GRAY
-
DARK_GRAY
-
BLACK
-
RED
-
GREEN
-
BLUE
-
YELLOW
-
CYAN
-
MAGENTA
-
ORANGE
-
CHARTREUSE
-
TEAL
-
AQUAMARINE
-
VIOLET
-
FUSCHIA
-
GARNET
-
AMBER
-
PINE
-
SEA_GREEN
-
NAVY
-
ROYAL_PURPLE
-
LUMINANCE_BIAS
-
-
Constructor Details
-
GUIColor
public GUIColor()Makes a new blank Color (RGBA (0,0,0,0)). -
GUIColor
public GUIColor(int argb) Makes a new color from a 32-bit ARGB integer (like from a BufferedImage).- Parameters:
argb-
-
GUIColor
public GUIColor(float red, float green, float blue) Makes a new color from channel components, with the alpha value as 1.- Parameters:
red- the red component (0 to 1).green- the green component (0 to 1).blue- the blue component (0 to 1).
-
GUIColor
public GUIColor(float red, float green, float blue, float alpha) Makes a new color from channel components.- Parameters:
red- the red component (0 to 1).green- the green component (0 to 1).blue- the blue component (0 to 1).alpha- the alpha component (0 to 1).
-
GUIColor
Makes a new color from an existing color.- Parameters:
c- the color to use.
-
-
Method Details
-
getRed
public float getRed()- Returns:
- the red component.
-
getGreen
public float getGreen()- Returns:
- the green component.
-
getBlue
public float getBlue()- Returns:
- the blue component.
-
getAlpha
public float getAlpha()- Returns:
- the alpha component, commonly used for blending operations.
-
set
Sets this color's info using another color.- Parameters:
c- the color to use.
-
set
public void set(float red, float green, float blue, float alpha) Sets this color's info using another color.- Parameters:
red- the red component (0 to 1).green- the green component (0 to 1).blue- the blue component (0 to 1).alpha- the alpha component (0 to 1).
-
set
public void set(int argb) Sets this color's info using another color.- Parameters:
argb- the ARGB formatted 32-bit color value.
-
setRed
public void setRed(float red) Sets the red component.- Parameters:
red- the new red component (0.0 to 1.0).
-
setGreen
public void setGreen(float green) Sets the green component.- Parameters:
green- the new green component (0.0 to 1.0).
-
setBlue
public void setBlue(float blue) Sets the blue component.- Parameters:
blue- the new blue component (0.0 to 1.0).
-
setAlpha
public void setAlpha(float alpha) Sets the alpha component, commonly used for blending operations.- Parameters:
alpha- the new alpha component (0.0 to 1.0).
-
getRGBA
public void getRGBA(float[] out) Returns this color's RGBA info into a float array.- Parameters:
out- the output array. Must be at least length 4.- Throws:
ArrayIndexOutOfBoundsException- if out has less than 4 elements.
-
getARGB
public int getARGB()- Returns:
- this color as an ARGB integer value.
-
scale
public void scale(float scalar) Multiplies all channels in this color by a scalar.- Parameters:
scalar- the scalar value.
-
add
Adds a color's components to this one. This changes this color's values.- Parameters:
c- the incoming color to use.
-
subtract
Subtracts a color's components from this one. This changes this color's values.- Parameters:
c- the incoming color to use.
-
multiply
Multiplies a color's components to this one. This changes this color's values.- Parameters:
c- the incoming color to use.
-
alphaBlend
Blends a color's component's to this one, using the incoming color's alpha channel as a blending factor. This changes this color's values.- Parameters:
c- the incoming color to use.
-
clamp
public void clamp()Clamps this color's channel values into the range 0 to 1. -
getARGB
public static int getARGB(float red, float green, float blue, float alpha) Converts RGBA floats to an ARGB integer.- Parameters:
red- the red component value (0 to 1).green- the green component value (0 to 1).blue- the blue component value (0 to 1).alpha- the alpha component value (0 to 1).- Returns:
- the resultant ARGB integer.
-
scale
-
add
-
subtract
-
multiply
-
alphaBlend
-
equals
-
equals
-