public class SquidColorCenter extends squidpony.IColorCenter.Skeleton<com.badlogic.gdx.graphics.Color>
IColorCenter
for libgdx's Color
.
Supports filtering any colors that this creates using a Filter
, such as one from Filters
.Another way to obtain colors by using pre-allocated (and named) instances.
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 |
---|---|
protected com.badlogic.gdx.graphics.Color |
create(int red,
int green,
int blue,
int opacity) |
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,
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) |
com.badlogic.gdx.graphics.Color |
get(float r,
float g,
float b,
float a) |
com.badlogic.gdx.graphics.Color |
get(long c) |
int |
getAlpha(com.badlogic.gdx.graphics.Color c) |
int |
getBlue(com.badlogic.gdx.graphics.Color c) |
int |
getGreen(com.badlogic.gdx.graphics.Color c) |
int |
getRed(com.badlogic.gdx.graphics.Color c) |
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.
|
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.
|
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 |
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,
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.
|
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.
|
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.
|
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.
|
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,
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.
|
String |
toString() |
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 SquidColorCenter()
public SquidColorCenter(squidpony.IFilter<com.badlogic.gdx.graphics.Color> filterEffect)
filterEffect
- The filter to use.protected com.badlogic.gdx.graphics.Color create(int red, int green, int blue, int opacity)
create
in class squidpony.IColorCenter.Skeleton<com.badlogic.gdx.graphics.Color>
public com.badlogic.gdx.graphics.Color filter(com.badlogic.gdx.graphics.Color c)
filter
in interface squidpony.IColorCenter<com.badlogic.gdx.graphics.Color>
filter
in class squidpony.IColorCenter.Skeleton<com.badlogic.gdx.graphics.Color>
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>
lerp
in class squidpony.IColorCenter.Skeleton<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 int getRed(com.badlogic.gdx.graphics.Color c)
public int getGreen(com.badlogic.gdx.graphics.Color c)
public int getBlue(com.badlogic.gdx.graphics.Color c)
public int getAlpha(com.badlogic.gdx.graphics.Color c)
public 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)
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)
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>
desaturated
in class squidpony.IColorCenter.Skeleton<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>
desaturate
in class squidpony.IColorCenter.Skeleton<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 saturated(com.badlogic.gdx.graphics.Color color)
saturated
in interface squidpony.IColorCenter<com.badlogic.gdx.graphics.Color>
saturated
in class squidpony.IColorCenter.Skeleton<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>
saturate
in class squidpony.IColorCenter.Skeleton<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 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 ArrayList<com.badlogic.gdx.graphics.Color> gradient(com.badlogic.gdx.graphics.Color fromColor, com.badlogic.gdx.graphics.Color toColor)
fromColor
- the color to start with, included in the gradienttoColor
- the color to end on, included in the gradientpublic ArrayList<com.badlogic.gdx.graphics.Color> gradient(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 gradientpublic 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 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 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 ArrayList<com.badlogic.gdx.graphics.Color> rainbow(int steps)
steps
- the number of different Color elements to generate in the returned ArrayListpublic 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 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 duplicatesCopyright © 2012–2016. All rights reserved.