public class SquidColorCenter
extends java.lang.Object
implements squidpony.IColorCenter<com.badlogic.gdx.graphics.Color>
IColorCenter
for libgdx's Color
.
Supports filtering any colors that this creates using an IFilter
, such as one from Filters
.
This class largely supersedes the earlier SColorFactory class, and supports similar operations
while also allowing filters to modify the returned colors. SColorFactory has been removed, so code transitioning
to SquidColorCenter may need to change blend() to lerp(Color, Color, double)
, and setFloor() to
setGranularity(int)
(with different behavior).Modifier and Type | Field and Description |
---|---|
protected com.badlogic.gdx.utils.IntMap<com.badlogic.gdx.graphics.Color> |
cache |
squidpony.IFilter<com.badlogic.gdx.graphics.Color> |
filter |
Constructor and Description |
---|
SquidColorCenter()
A fresh filter-less color center.
|
SquidColorCenter(squidpony.IFilter<com.badlogic.gdx.graphics.Color> filterEffect)
A fresh filtered color center.
|
Modifier and Type | Method and Description |
---|---|
int |
cacheSize()
The actual cache is not public, but there are cases where you may want to know how many different colors are
actually used in a frame or a section of the game.
|
void |
clearCache()
It clears the cache.
|
void |
copyCache(SquidColorCenter other)
You may want to copy colors between IColorCenter instances that have different create() methods -- and as
such, will have different values for the same keys in the cache.
|
com.badlogic.gdx.graphics.Color |
desaturate(com.badlogic.gdx.graphics.Color color,
double degree)
Brings a color closer to grayscale by the specified degree and returns the new color (desaturated somewhat).
|
com.badlogic.gdx.graphics.Color |
desaturate(com.badlogic.gdx.graphics.Color color,
float degree)
Brings a color closer to grayscale by the specified degree and returns the new color (desaturated somewhat).
|
com.badlogic.gdx.graphics.Color |
desaturated(com.badlogic.gdx.graphics.Color color)
Gets a fully-desaturated version of the given color (keeping its brightness, but making it grayscale).
|
com.badlogic.gdx.graphics.Color |
dim(com.badlogic.gdx.graphics.Color color)
Darkens a color slightly and returns the new color (10% mix with black).
|
com.badlogic.gdx.graphics.Color |
dim(com.badlogic.gdx.graphics.Color color,
double degree)
Darkens a color by the specified degree and returns the new color (mixed with black).
|
com.badlogic.gdx.graphics.Color |
dim(com.badlogic.gdx.graphics.Color color,
float degree)
Darkens a color by the specified degree and returns the new color (mixed with black).
|
com.badlogic.gdx.graphics.Color |
dimmer(com.badlogic.gdx.graphics.Color color)
Darkens a color significantly and returns the new color (30% mix with black).
|
com.badlogic.gdx.graphics.Color |
dimmest(com.badlogic.gdx.graphics.Color color)
Darkens a color massively and returns the new color (70% mix with black).
|
static int |
encode(com.badlogic.gdx.graphics.Color color) |
com.badlogic.gdx.graphics.Color |
filter(com.badlogic.gdx.graphics.Color c) |
squidpony.panel.IColoredString<com.badlogic.gdx.graphics.Color> |
filter(squidpony.panel.IColoredString<com.badlogic.gdx.graphics.Color> ics) |
com.badlogic.gdx.graphics.Color |
get(float r,
float g,
float b,
float a) |
com.badlogic.gdx.graphics.Color |
get(int red,
int green,
int blue) |
com.badlogic.gdx.graphics.Color |
get(int red,
int green,
int blue,
int opacity) |
com.badlogic.gdx.graphics.Color |
get(long c) |
int |
getAlpha(com.badlogic.gdx.graphics.Color c) |
com.badlogic.gdx.graphics.Color |
getBlack() |
int |
getBlue(com.badlogic.gdx.graphics.Color c) |
int |
getGranularity()
Gets the granularity, which is how different requested colors need to be to make a new color; can be from 0 to 6.
|
int |
getGreen(com.badlogic.gdx.graphics.Color c) |
com.badlogic.gdx.graphics.Color |
getHSV(float hue,
float saturation,
float value) |
com.badlogic.gdx.graphics.Color |
getHSV(float hue,
float saturation,
float value,
float opacity) |
float |
getHue(com.badlogic.gdx.graphics.Color c) |
float |
getHue(float r,
float g,
float b) |
com.badlogic.gdx.graphics.Color |
getRandom(squidpony.squidmath.IRNG rng,
int opacity) |
int |
getRed(com.badlogic.gdx.graphics.Color c) |
float |
getSaturation(com.badlogic.gdx.graphics.Color c) |
float |
getSaturation(float r,
float g,
float b) |
com.badlogic.gdx.graphics.Color |
getTransparent() |
float |
getValue(com.badlogic.gdx.graphics.Color c) |
float |
getValue(float r,
float g,
float b) |
com.badlogic.gdx.graphics.Color |
getWhite() |
java.util.ArrayList<com.badlogic.gdx.graphics.Color> |
gradient(com.badlogic.gdx.graphics.Color fromColor,
com.badlogic.gdx.graphics.Color toColor)
Finds a 16-step gradient going from fromColor to toColor, both included in the gradient.
|
java.util.ArrayList<com.badlogic.gdx.graphics.Color> |
gradient(com.badlogic.gdx.graphics.Color fromColor,
com.badlogic.gdx.graphics.Color toColor,
int steps)
Finds a gradient with the specified number of steps going from fromColor to toColor,
both included in the gradient.
|
java.util.ArrayList<com.badlogic.gdx.graphics.Color> |
gradient(com.badlogic.gdx.graphics.Color fromColor,
com.badlogic.gdx.graphics.Color toColor,
int steps,
com.badlogic.gdx.math.Interpolation interpolation)
Finds a gradient with the specified number of steps going from fromColor to toColor, both included in the
gradient.
|
com.badlogic.gdx.graphics.Color |
greify(com.badlogic.gdx.graphics.Color color,
boolean doAlpha)
Gets a copy of t and modifies it to make a shade of gray with the same brightness.
|
com.badlogic.gdx.graphics.Color |
invert(com.badlogic.gdx.graphics.Color start) |
com.badlogic.gdx.graphics.Color |
lerp(com.badlogic.gdx.graphics.Color start,
com.badlogic.gdx.graphics.Color end,
double change)
Gets the linear interpolation from Color start to Color end, changing by the fraction given by change.
|
com.badlogic.gdx.graphics.Color |
lerp(com.badlogic.gdx.graphics.Color start,
com.badlogic.gdx.graphics.Color end,
float change)
Gets the linear interpolation from Color start to Color end, changing by the fraction given by change.
|
com.badlogic.gdx.graphics.Color |
light(com.badlogic.gdx.graphics.Color color)
Lightens a color slightly and returns the new color (10% mix with white).
|
com.badlogic.gdx.graphics.Color |
light(com.badlogic.gdx.graphics.Color color,
double degree)
Lightens a color by degree and returns the new color (mixed with white).
|
com.badlogic.gdx.graphics.Color |
light(com.badlogic.gdx.graphics.Color color,
float degree)
Lightens a color by degree and returns the new color (mixed with white).
|
com.badlogic.gdx.graphics.Color |
lighter(com.badlogic.gdx.graphics.Color color)
Lightens a color significantly and returns the new color (30% mix with white).
|
com.badlogic.gdx.graphics.Color |
lightest(com.badlogic.gdx.graphics.Color color)
Lightens a color massively and returns the new color (70% mix with white).
|
com.badlogic.gdx.graphics.Color |
lightWith(com.badlogic.gdx.graphics.Color color,
com.badlogic.gdx.graphics.Color light)
Gets a modified copy of color as if it is lit with a colored light source.
|
java.util.ArrayList<com.badlogic.gdx.graphics.Color> |
loopingGradient(com.badlogic.gdx.graphics.Color fromColor,
com.badlogic.gdx.graphics.Color midColor,
int steps)
Finds a gradient with the specified number of steps going from fromColor to midColor, then midColor to (possibly)
fromColor, with both included in the gradient but fromColor only repeated at the end if the number of steps is odd.
|
java.util.ArrayList<com.badlogic.gdx.graphics.Color> |
loopingGradient(com.badlogic.gdx.graphics.Color fromColor,
com.badlogic.gdx.graphics.Color midColor,
int steps,
com.badlogic.gdx.math.Interpolation interpolation)
Finds a gradient with the specified number of steps going from fromColor to midColor, then midColor to (possibly)
fromColor, with both included in the gradient but fromColor only repeated at the end if the number of steps is
odd.
|
java.util.ArrayList<com.badlogic.gdx.graphics.Color> |
rainbow(double saturation,
double value,
double opacity,
int steps)
Generates a hue-shifted rainbow of colors, starting at red and going through orange, yellow, green, blue, and
purple before getting close to red at the end again.
|
java.util.ArrayList<com.badlogic.gdx.graphics.Color> |
rainbow(double saturation,
double value,
int steps)
Generates a hue-shifted rainbow of colors, starting at red and going through orange, yellow, green, blue, and
purple before getting close to red at the end again.
|
java.util.ArrayList<com.badlogic.gdx.graphics.Color> |
rainbow(float saturation,
float value,
float opacity,
int steps)
Generates a hue-shifted rainbow of colors, starting at red and going through orange, yellow, green, blue, and
purple before getting close to red at the end again.
|
java.util.ArrayList<com.badlogic.gdx.graphics.Color> |
rainbow(float saturation,
float value,
int steps)
Generates a hue-shifted rainbow of colors, starting at red and going through orange, yellow, green, blue, and
purple before getting close to red at the end again.
|
java.util.ArrayList<com.badlogic.gdx.graphics.Color> |
rainbow(int steps)
Generates a hue-shifted rainbow of colors, starting at red and going through orange, yellow, green, blue, and
purple before getting close to red at the end again.
|
com.badlogic.gdx.graphics.Color |
random()
Gets a fully random color that is only required to be opaque.
|
com.badlogic.gdx.graphics.Color |
randomBlend(com.badlogic.gdx.graphics.Color a,
com.badlogic.gdx.graphics.Color b)
Blends the colors A and B by a random degree.
|
com.badlogic.gdx.graphics.Color |
randomize(com.badlogic.gdx.graphics.Color color)
Blends a color with a random (opaque) color by a factor of 10% random.
|
com.badlogic.gdx.graphics.Color |
randomizeMore(com.badlogic.gdx.graphics.Color color)
Blends a color with a random (opaque) color by a factor of 30% random.
|
com.badlogic.gdx.graphics.Color |
randomizeMost(com.badlogic.gdx.graphics.Color color)
Blends a color with a random (opaque) color by a factor of 70% random.
|
com.badlogic.gdx.graphics.Color |
saturate(com.badlogic.gdx.graphics.Color color,
double 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).
|
com.badlogic.gdx.graphics.Color |
saturate(com.badlogic.gdx.graphics.Color 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).
|
com.badlogic.gdx.graphics.Color |
saturated(com.badlogic.gdx.graphics.Color color)
Fully saturates color (makes it a vivid color like red or green and less gray) and returns the modified copy.
|
void |
setGranularity(int granularity)
Sets the granularity, which is how different requested colors must be to make a new color; from 0 to at most 6.
|
java.lang.String |
toString() |
java.util.ArrayList<com.badlogic.gdx.graphics.Color> |
zigzagGradient(com.badlogic.gdx.graphics.Color fromColor,
com.badlogic.gdx.graphics.Color toColor,
int steps)
Finds a gradient with the specified number of steps going from fromColor to toColor, both included in the
gradient.
|
public squidpony.IFilter<com.badlogic.gdx.graphics.Color> filter
protected com.badlogic.gdx.utils.IntMap<com.badlogic.gdx.graphics.Color> cache
public SquidColorCenter()
public SquidColorCenter(squidpony.IFilter<com.badlogic.gdx.graphics.Color> filterEffect)
filterEffect
- The filter to use.public int getGranularity()
public void setGranularity(int granularity)
granularity
- the granularity to use; will be clamped between 0 and 6public com.badlogic.gdx.graphics.Color get(int red, int green, int blue, int opacity)
get
in interface squidpony.IColorCenter<com.badlogic.gdx.graphics.Color>
public com.badlogic.gdx.graphics.Color get(int red, int green, int blue)
get
in interface squidpony.IColorCenter<com.badlogic.gdx.graphics.Color>
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).public com.badlogic.gdx.graphics.Color getHSV(float hue, float saturation, float value, float opacity)
getHSV
in interface squidpony.IColorCenter<com.badlogic.gdx.graphics.Color>
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.public com.badlogic.gdx.graphics.Color getHSV(float hue, float saturation, float value)
getHSV
in interface squidpony.IColorCenter<com.badlogic.gdx.graphics.Color>
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).public com.badlogic.gdx.graphics.Color getWhite()
getWhite
in interface squidpony.IColorCenter<com.badlogic.gdx.graphics.Color>
public com.badlogic.gdx.graphics.Color getBlack()
getBlack
in interface squidpony.IColorCenter<com.badlogic.gdx.graphics.Color>
public com.badlogic.gdx.graphics.Color getTransparent()
getTransparent
in interface squidpony.IColorCenter<com.badlogic.gdx.graphics.Color>
public com.badlogic.gdx.graphics.Color getRandom(squidpony.squidmath.IRNG rng, int opacity)
getRandom
in interface squidpony.IColorCenter<com.badlogic.gdx.graphics.Color>
rng
- any IRNG from SquidLib, such as an RNG, StatefulRNG, or GWTRNG.opacity
- The alpha component. In-between 0 (inclusive) and 256
(exclusive). Larger values mean more opacity; 0 is clear.public com.badlogic.gdx.graphics.Color filter(com.badlogic.gdx.graphics.Color c)
filter
in interface squidpony.IColorCenter<com.badlogic.gdx.graphics.Color>
public squidpony.panel.IColoredString<com.badlogic.gdx.graphics.Color> filter(squidpony.panel.IColoredString<com.badlogic.gdx.graphics.Color> ics)
filter
in interface squidpony.IColorCenter<com.badlogic.gdx.graphics.Color>
ics
- an IColoredString, often produced by GDXMarkup.colorString(CharSequence)
.ics
filtered according to filter(Color)
. May be
ics
itself if unchanged.public com.badlogic.gdx.graphics.Color greify(com.badlogic.gdx.graphics.Color color, boolean doAlpha)
greify
in interface squidpony.IColorCenter<com.badlogic.gdx.graphics.Color>
color
- a T to copy; only the copy will be modifieddoAlpha
- Whether to include (and hereby change) the alpha component; if false alpha is kept as-ist
.public com.badlogic.gdx.graphics.Color get(long c)
public com.badlogic.gdx.graphics.Color get(float r, float g, float b, float a)
public com.badlogic.gdx.graphics.Color lerp(com.badlogic.gdx.graphics.Color start, com.badlogic.gdx.graphics.Color end, float change)
lerp
in interface squidpony.IColorCenter<com.badlogic.gdx.graphics.Color>
start
- the initial Colorend
- the "target" colorchange
- the degree to change closer to end; a change of 0.0f produces start, 1.0f produces endpublic com.badlogic.gdx.graphics.Color lerp(com.badlogic.gdx.graphics.Color start, com.badlogic.gdx.graphics.Color end, double change)
start
- the initial Colorend
- the "target" colorchange
- the degree to change closer to end; a change of 0.0 produces start, 1.0 produces endpublic int getRed(com.badlogic.gdx.graphics.Color c)
getRed
in interface squidpony.IColorCenter<com.badlogic.gdx.graphics.Color>
public int getGreen(com.badlogic.gdx.graphics.Color c)
getGreen
in interface squidpony.IColorCenter<com.badlogic.gdx.graphics.Color>
public int getBlue(com.badlogic.gdx.graphics.Color c)
getBlue
in interface squidpony.IColorCenter<com.badlogic.gdx.graphics.Color>
public int getAlpha(com.badlogic.gdx.graphics.Color c)
getAlpha
in interface squidpony.IColorCenter<com.badlogic.gdx.graphics.Color>
public float getHue(com.badlogic.gdx.graphics.Color c)
getHue
in interface squidpony.IColorCenter<com.badlogic.gdx.graphics.Color>
c
- a concrete colorpublic float getSaturation(com.badlogic.gdx.graphics.Color c)
getSaturation
in interface squidpony.IColorCenter<com.badlogic.gdx.graphics.Color>
c
- a concrete colorpublic float getSaturation(float r, float g, float b)
r
- the red component in 0.0 to 1.0 range, typicallyg
- the green component in 0.0 to 1.0 range, typicallyb
- the blue component in 0.0 to 1.0 range, typicallypublic float getValue(float r, float g, float b)
r
- the red component in 0.0 to 1.0 range, typicallyg
- the green component in 0.0 to 1.0 range, typicallyb
- the blue component in 0.0 to 1.0 range, typicallypublic float getHue(float r, float g, float b)
r
- the red component in 0.0 to 1.0 range, typicallyg
- the green component in 0.0 to 1.0 range, typicallyb
- the blue component in 0.0 to 1.0 range, typicallypublic float getValue(com.badlogic.gdx.graphics.Color c)
getValue
in interface squidpony.IColorCenter<com.badlogic.gdx.graphics.Color>
c
- a concrete colorpublic static int encode(com.badlogic.gdx.graphics.Color color)
public com.badlogic.gdx.graphics.Color lightWith(com.badlogic.gdx.graphics.Color color, com.badlogic.gdx.graphics.Color light)
color
- the color to shine the light onlight
- the color of the light sourcepublic com.badlogic.gdx.graphics.Color light(com.badlogic.gdx.graphics.Color color, float degree)
color
- the color to lightendegree
- a float between 0.0f and 1.0f; more makes it lighterpublic com.badlogic.gdx.graphics.Color light(com.badlogic.gdx.graphics.Color color, double degree)
color
- the color to lightendegree
- a double between 0.0 and 1.0; more makes it lighterpublic com.badlogic.gdx.graphics.Color light(com.badlogic.gdx.graphics.Color color)
color
- the color to lightenpublic com.badlogic.gdx.graphics.Color lighter(com.badlogic.gdx.graphics.Color color)
color
- the color to lightenpublic com.badlogic.gdx.graphics.Color lightest(com.badlogic.gdx.graphics.Color color)
color
- the color to lightenpublic com.badlogic.gdx.graphics.Color dim(com.badlogic.gdx.graphics.Color color, float degree)
color
- the color to darkendegree
- a float between 0.0f and 1.0f; more makes it darkerpublic com.badlogic.gdx.graphics.Color dim(com.badlogic.gdx.graphics.Color color, double degree)
color
- the color to darkendegree
- a double between 0.0 and 1.0; more makes it darkerpublic com.badlogic.gdx.graphics.Color dim(com.badlogic.gdx.graphics.Color color)
color
- the color to darkenpublic com.badlogic.gdx.graphics.Color dimmer(com.badlogic.gdx.graphics.Color color)
color
- the color to darkenpublic com.badlogic.gdx.graphics.Color dimmest(com.badlogic.gdx.graphics.Color color)
color
- the color to darkenpublic com.badlogic.gdx.graphics.Color desaturated(com.badlogic.gdx.graphics.Color color)
desaturated
in interface squidpony.IColorCenter<com.badlogic.gdx.graphics.Color>
color
- the color to desaturate (will not be modified)public com.badlogic.gdx.graphics.Color desaturate(com.badlogic.gdx.graphics.Color color, float degree)
desaturate
in interface squidpony.IColorCenter<com.badlogic.gdx.graphics.Color>
color
- the color to desaturatedegree
- a float between 0.0f and 1.0f; more makes it less colorfulpublic com.badlogic.gdx.graphics.Color desaturate(com.badlogic.gdx.graphics.Color color, double degree)
color
- the color to desaturatedegree
- a double between 0.0 and 1.0; more makes it less colorfulpublic com.badlogic.gdx.graphics.Color saturated(com.badlogic.gdx.graphics.Color color)
saturated
in interface squidpony.IColorCenter<com.badlogic.gdx.graphics.Color>
color
- the color T to saturate (will not be modified)public com.badlogic.gdx.graphics.Color saturate(com.badlogic.gdx.graphics.Color color, float degree)
saturate
in interface squidpony.IColorCenter<com.badlogic.gdx.graphics.Color>
color
- the color to saturatedegree
- a float between 0.0f and 1.0f; more makes it more colorfulpublic com.badlogic.gdx.graphics.Color saturate(com.badlogic.gdx.graphics.Color color, double degree)
color
- the color to saturatedegree
- a double between 0.0 and 1.0; more makes it more colorfulpublic com.badlogic.gdx.graphics.Color random()
public com.badlogic.gdx.graphics.Color randomize(com.badlogic.gdx.graphics.Color color)
color
- the color to randomizepublic com.badlogic.gdx.graphics.Color randomizeMore(com.badlogic.gdx.graphics.Color color)
color
- the color to randomizepublic com.badlogic.gdx.graphics.Color randomizeMost(com.badlogic.gdx.graphics.Color color)
color
- the color to randomizepublic com.badlogic.gdx.graphics.Color randomBlend(com.badlogic.gdx.graphics.Color a, com.badlogic.gdx.graphics.Color b)
a
- a color to mix inb
- another color to mix inpublic com.badlogic.gdx.graphics.Color invert(com.badlogic.gdx.graphics.Color start)
public java.util.ArrayList<com.badlogic.gdx.graphics.Color> gradient(com.badlogic.gdx.graphics.Color fromColor, com.badlogic.gdx.graphics.Color toColor)
gradient
in interface squidpony.IColorCenter<com.badlogic.gdx.graphics.Color>
fromColor
- the color to start with, included in the gradienttoColor
- the color to end on, included in the gradientpublic java.util.ArrayList<com.badlogic.gdx.graphics.Color> gradient(com.badlogic.gdx.graphics.Color fromColor, com.badlogic.gdx.graphics.Color toColor, int steps)
gradient
in interface squidpony.IColorCenter<com.badlogic.gdx.graphics.Color>
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 gradientpublic java.util.ArrayList<com.badlogic.gdx.graphics.Color> loopingGradient(com.badlogic.gdx.graphics.Color fromColor, com.badlogic.gdx.graphics.Color midColor, int steps)
fromColor
- the color to start with (and end with, if steps is an odd number), included in the gradientmidColor
- the color to use in the middle of the loop, included in the gradientsteps
- the number of elements to use in the gradient, will be at least 3public java.util.ArrayList<com.badlogic.gdx.graphics.Color> gradient(com.badlogic.gdx.graphics.Color fromColor, com.badlogic.gdx.graphics.Color toColor, int steps, com.badlogic.gdx.math.Interpolation interpolation)
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 gradientinterpolation
- a libGDX Interpolation that defines how quickly the color changes during the transitionpublic java.util.ArrayList<com.badlogic.gdx.graphics.Color> loopingGradient(com.badlogic.gdx.graphics.Color fromColor, com.badlogic.gdx.graphics.Color midColor, int steps, com.badlogic.gdx.math.Interpolation interpolation)
fromColor
- the color to start with (and end with, if steps is an odd number), included in the gradientmidColor
- the color to use in the middle of the loop, included in the gradientsteps
- the number of elements to use in the gradient, will be at least 3interpolation
- a libGDX Interpolation that defines how quickly the color changes at the start and end of
each transition, both from fromColor to midColor as well as back to fromColorpublic java.util.ArrayList<com.badlogic.gdx.graphics.Color> rainbow(int steps)
steps
- the number of different Color elements to generate in the returned ArrayListpublic java.util.ArrayList<com.badlogic.gdx.graphics.Color> rainbow(float saturation, float value, int steps)
saturation
- the saturation of the rainbow's colors; 1.0 is boldest and 0.0 is grayscalevalue
- the brightness of the rainbow's colors; 1.0 is brighteststeps
- the number of different Color elements to generate in the returned ArrayListpublic java.util.ArrayList<com.badlogic.gdx.graphics.Color> rainbow(float saturation, float value, float opacity, int steps)
saturation
- the saturation of the rainbow's colors; 1.0 is boldest and 0.0 is grayscalevalue
- the brightness of the rainbow's colors; 1.0 is brightestopacity
- the alpha value of all colors in the rainbow; 0.0 is fully transparent and 1.0 is opaquesteps
- the number of different Color elements to generate in the returned ArrayListpublic java.util.ArrayList<com.badlogic.gdx.graphics.Color> rainbow(double saturation, double value, int steps)
saturation
- the saturation of the rainbow's colors; 1.0 is boldest and 0.0 is grayscalevalue
- the brightness of the rainbow's colors; 1.0 is brighteststeps
- the number of different Color elements to generate in the returned ArrayListpublic java.util.ArrayList<com.badlogic.gdx.graphics.Color> rainbow(double saturation, double value, double opacity, int steps)
saturation
- the saturation of the rainbow's colors; 1.0 is boldest and 0.0 is grayscalevalue
- the brightness of the rainbow's colors; 1.0 is brightestopacity
- the alpha value of all colors in the rainbow; 0.0 is fully transparent and 1.0 is opaquesteps
- the number of different Color elements to generate in the returned ArrayListpublic java.util.ArrayList<com.badlogic.gdx.graphics.Color> zigzagGradient(com.badlogic.gdx.graphics.Color fromColor, com.badlogic.gdx.graphics.Color 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 gradient; ideally no greater than 345 to avoid duplicatespublic java.lang.String toString()
toString
in class java.lang.Object
public void clearCache()
public int cacheSize()
clearCache()
), some colors were requested, then this is called, the returned int should be the
count of distinct colors this IColorCenter had created and cached; duplicates won't be counted twice.public void copyCache(SquidColorCenter other)
other
- another Skeleton of the same type that will have its cache copied into this SkeletonCopyright © Eben Howard 2012–2022. All rights reserved.