T
- The concrete type of colorspublic interface IColorCenter<T>
If you aren't using squidlib's gdx part, you should use this interface (and
the IColorCenter.Skeleton
implementation), because it caches instances.
If you are using squidlib's gdx part, you should use this interface (and the
SquidColorCenter
implementation) if:
squidpony.squidgrid.gui.Colors
)com.badlogic.gdx.graphics.Colors
)Modifier and Type | Interface and Description |
---|---|
static class |
IColorCenter.Skeleton<T>
A skeletal implementation of
IColorCenter . |
Modifier and Type | Method and Description |
---|---|
T |
desaturate(T color,
float degree)
Brings a color closer to grayscale by the specified degree and returns the new color (desaturated somewhat).
|
T |
desaturated(T color)
Gets a fully-desaturated version of the given color (keeping its brightness, but making it grayscale).
|
IColoredString<T> |
filter(IColoredString<T> ics) |
T |
filter(T c) |
T |
get(int red,
int green,
int blue) |
T |
get(int red,
int green,
int blue,
int opacity) |
int |
getAlpha(T c) |
T |
getBlack() |
int |
getBlue(T c) |
int |
getGreen(T c) |
T |
getHSV(float hue,
float saturation,
float value) |
T |
getHSV(float hue,
float saturation,
float value,
float opacity) |
float |
getHue(T c) |
T |
getRandom(IRNG rng,
int opacity) |
int |
getRed(T c) |
float |
getSaturation(T c) |
T |
getTransparent() |
float |
getValue(T c) |
T |
getWhite() |
java.util.ArrayList<T> |
gradient(T fromColor,
T toColor)
Finds a gradient with 16 steps going from fromColor to toColor,
both included in the gradient.
|
java.util.ArrayList<T> |
gradient(T fromColor,
T toColor,
int steps)
Finds a gradient with the specified number of steps going from fromColor to toColor,
both included in the gradient.
|
T |
greify(T t,
boolean doAlpha)
Gets a copy of t and modifies it to make a shade of gray with the same brightness.
|
T |
lerp(T start,
T end,
float change)
Gets the linear interpolation from Color start to Color end, changing by the fraction given by change.
|
T |
saturate(T color,
float degree)
Saturates color (makes it closer to a vivid color like red or green and less gray) by the specified degree and
returns the new color (saturated somewhat).
|
T |
saturated(T color)
Fully saturates color (makes it a vivid color like red or green and less gray) and returns the modified copy.
|
T get(int red, int green, int blue, int opacity)
red
- The red component. For screen colors, in-between 0 (inclusive)
and 256 (exclusive).green
- The green component. For screen colors, in-between 0 (inclusive)
and 256 (exclusive).blue
- The blue component. For screen colors, in-between 0 (inclusive)
and 256 (exclusive).opacity
- The alpha component. In-between 0 (inclusive) and 256
(exclusive). Larger values mean more opacity; 0 is clear.T get(int red, int green, int blue)
red
- The red component. For screen colors, in-between 0 (inclusive)
and 256 (exclusive).green
- The green component. For screen colors, in-between 0 (inclusive)
and 256 (exclusive).blue
- The blue component. For screen colors, in-between 0 (inclusive)
and 256 (exclusive).T getHSV(float hue, float saturation, float value, float opacity)
hue
- The hue of the desired color from 0.0 (red, inclusive) towards orange, then
yellow, and eventually to purple before looping back to almost the same red
(1.0, exclusive). Values outside this range should be treated as wrapping
around, so 1.1f and -0.9f would be the same as 0.1f .saturation
- the saturation of the color from 0.0 (a grayscale color; inclusive)
to 1.0 (a bright color, inclusive)value
- the value (essentially lightness) of the color from 0.0 (black,
inclusive) to 1.0 (very bright, inclusive).opacity
- the alpha component as a float; 0.0f is clear, 1.0f is opaque.T getHSV(float hue, float saturation, float value)
hue
- The hue of the desired color from 0.0 (red, inclusive) towards orange, then
yellow, and eventually to purple before looping back to almost the same red
(1.0, exclusive)saturation
- the saturation of the color from 0.0 (a grayscale color; inclusive)
to 1.0 (a bright color, exclusive)value
- the value (essentially lightness) of the color from 0.0 (black,
inclusive) to 1.0 (very bright, inclusive).T getWhite()
T getBlack()
T getTransparent()
T getRandom(IRNG rng, int opacity)
rng
- an RNG from SquidLib.opacity
- The alpha component. In-between 0 (inclusive) and 256
(exclusive). Larger values mean more opacity; 0 is clear.int getRed(T c)
c
- a concrete colorint getGreen(T c)
c
- a concrete colorint getBlue(T c)
c
- a concrete colorint getAlpha(T c)
c
- a concrete colorfloat getHue(T c)
c
- a concrete colorfloat getSaturation(T c)
c
- a concrete colorfloat getValue(T c)
c
- a concrete colorT filter(T c)
c
- this
shows when c
is requested. May be c
itself.IColoredString<T> filter(IColoredString<T> ics)
ics
- ics
filtered according to filter(Object)
. May be
ics
itself if unchanged.T greify(T t, boolean doAlpha)
t
- a T to copy; only the copy will be modifieddoAlpha
- Whether to include (and hereby change) the alpha component.t
.T lerp(T start, T end, float change)
start
- the initial color Tend
- the "target" color Tchange
- the degree to change closer to end; a change of 0.0f produces start, 1.0f produces endT desaturated(T color)
color
- the color T to desaturate (will not be modified)T desaturate(T color, float degree)
color
- the color T to desaturatedegree
- a float between 0.0f and 1.0f; more makes it less colorfulT saturated(T color)
color
- the color T to saturate (will not be modified)T saturate(T color, float degree)
color
- the color T to saturatedegree
- a float between 0.0f and 1.0f; more makes it more colorfuljava.util.ArrayList<T> gradient(T fromColor, T toColor)
fromColor
- the color to start with, included in the gradienttoColor
- the color to end on, included in the gradientjava.util.ArrayList<T> gradient(T fromColor, T toColor, int steps)
fromColor
- the color to start with, included in the gradienttoColor
- the color to end on, included in the gradientsteps
- the number of elements to use in the gradientCopyright © Eben Howard 2012–2022. All rights reserved.