Class MutableColor
java.lang.Object
com.stereowalker.unionlib.util.math.MutableColor
- All Implemented Interfaces:
Color
-
Field Summary
FieldsModifier and TypeFieldDescriptionfloatComponents [0..1]floatComponents [0..1]floatComponents [0..1]floatComponents [0..1] -
Constructor Summary
ConstructorsConstructorDescriptionMutableColor(float r, float g, float b) RGB constructor, alpha defaults to 1.0.MutableColor(float r, float g, float b, float a) Constructs a Color with given float components.MutableColor(int r, int g, int b) RGB constructor with ints (0–255), alpha defaults to 255.MutableColor(int r, int g, int b, int a) Constructs a Color with int components (0–255). -
Method Summary
Modifier and TypeMethodDescriptionfloata()Alpha component [0..1]a(float alp) Sets the alpha of this color.floatb()Blue component [0..1]b(float blu) Sets the blue value of this color.Alpha‐compositesoveron top of this color (this = “background,” over = “foreground”).brighten(float factor) Returns a brighter version of this color by multiplying each RGB byfactor(>1).darken(float factor) Returns a darker version of this color by dividing each RGB byfactor(>1).booleanfloatg()Green component [0..1]g(float gre) Sets the green value of this color.Returns a grayscale version of this color, preserving alpha.inthashCode()invert()Returns an inverted‐color version of this color (ignoring alpha).Returns a new Color that is the linear interpolation between this andother.Returns a new Color that is this color multiplied component‐wise byother.floatr()Red component [0..1]r(float red) Sets the red value of this color.toString()withValues(float r, float g, float b) withValues(float r, float g, float b, float a) Methods inherited from interface Color
a, b, blend, brighten, colorEquals, colorHashCode, colorToString, darken, g, getAlphaInt, getBlueInt, getGreenInt, getRedInt, grayscale, invert, lerp, multiply, r, toCMYK, toHexRGBString, toHSL, toHSLA, toHSV, toImmutable, toIntARGB, toIntRGB, toIntRGBA, toMutable
-
Field Details
-
r
public float rComponents [0..1] -
g
public float gComponents [0..1] -
b
public float bComponents [0..1] -
a
public float aComponents [0..1]
-
-
Constructor Details
-
MutableColor
public MutableColor(float r, float g, float b, float a) Constructs a Color with given float components. Each value is clamped to [0,1].- Parameters:
r- red (0.0–1.0)g- green (0.0–1.0)b- blue (0.0–1.0)a- alpha (0.0–1.0)
-
MutableColor
public MutableColor(int r, int g, int b, int a) Constructs a Color with int components (0–255). Values are clamped internally.- Parameters:
r- red (0–255)g- green (0–255)b- blue (0–255)a- alpha (0–255)
-
MutableColor
public MutableColor(float r, float g, float b) RGB constructor, alpha defaults to 1.0.- Parameters:
r- red (0.0–1.0)g- green (0.0–1.0)b- blue (0.0–1.0)
-
MutableColor
public MutableColor(int r, int g, int b) RGB constructor with ints (0–255), alpha defaults to 255.- Parameters:
r- red (0–255)g- green (0–255)b- blue (0–255)
-
-
Method Details
-
r
-
g
-
b
-
a
-
withValues
- Specified by:
withValuesin interfaceColor
-
withValues
- Specified by:
withValuesin interfaceColor
-
lerp
Description copied from interface:ColorReturns a new Color that is the linear interpolation between this andother. -
multiply
Description copied from interface:ColorReturns a new Color that is this color multiplied component‐wise byother. -
blend
Description copied from interface:ColorAlpha‐compositesoveron top of this color (this = “background,” over = “foreground”). -
invert
Description copied from interface:ColorReturns an inverted‐color version of this color (ignoring alpha). -
grayscale
Description copied from interface:ColorReturns a grayscale version of this color, preserving alpha. Uses standard luminosity formula: gray = 0.299R + 0.587G + 0.114B. -
brighten
Description copied from interface:ColorReturns a brighter version of this color by multiplying each RGB byfactor(>1). Alpha is unchanged. -
darken
Description copied from interface:ColorReturns a darker version of this color by dividing each RGB byfactor(>1). Alpha is unchanged. -
r
Description copied from interface:ColorSets the red value of this color. -
g
Description copied from interface:ColorSets the green value of this color. -
b
Description copied from interface:ColorSets the blue value of this color. -
a
Description copied from interface:ColorSets the alpha of this color. -
equals
-
hashCode
-
toString
-