public class SColorFactory
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
addPallet(java.lang.String name,
java.util.ArrayList<SColor> pallet)
Places the pallet into the cache, along with each of the member colors.
|
static java.util.ArrayList<SColor> |
asGradient(SColor color1,
SColor color2)
Returns a list of colors starting at the first color and moving to the
second color.
|
static SColor |
asSColor(java.awt.Color color)
Returns an SColor representation of the provided Color.
|
static SColor |
asSColor(int rgb)
Returns the cached color that matches the desired rgb value.
|
static SColor |
asSColor(int r,
int g,
int b)
Returns an SColor with the given values, with those values clamped
between 0 and 255.
|
static SColor |
blend(SColor color1,
SColor color2,
double coef)
Returns an SColor that is the given distance from the first color to the
second color.
|
static SColor |
colorForName(java.lang.String s)
Returns the SColor Constant who's name is the one provided.
|
static SColor |
colorForValue(int rgb)
Returns the SColor who's value matches the one passed in.
|
static SColor |
desaturate(SColor color,
double percent)
Returns an SColor that is the version of the provided color desaturated
the given amount.
|
static SColor |
desaturated(SColor color)
Returns an SColor that is the fully desaturated (greyscale) version of
the provided color.
|
static SColor |
dim(SColor color)
Returns an SColor that is a slightly dimmer version of the provided
color.
|
static SColor |
dimmer(SColor color)
Returns an SColor that is a somewhat dimmer version of the provided
color.
|
static SColor |
dimmest(SColor color)
Returns an SColor that is a lot darker version of the provided color.
|
static void |
emptyCache()
Clears the backing cache.
|
static SColor |
fromPallet(java.lang.String name,
float percent)
Returns the SColor that is the provided percent towards the end of the
pallet.
|
static SColor |
light(SColor color)
Returns an SColor that is a slightly lighter version of the provided
color.
|
static SColor |
lighter(SColor color)
Returns an SColor that is a somewhat lighter version of the provided
color.
|
static SColor |
lightest(SColor color)
Returns an SColor that is a lot lighter version of the provided color.
|
static java.util.ArrayList<SColor> |
pallet(java.lang.String name)
Returns the pallet associate with the provided name, or null if there is
no such pallet.
|
static int |
quantityCached()
Returns the number of SColor objects currently cached.
|
static SColor |
randomBlend(SColor color1,
SColor color2,
double min,
double max)
Returns an SColor that is randomly chosen from the color line between the
two provided colors from the two provided points.
|
static void |
setFloor(int value)
Sets the value at which each of the red, green, and blue values will be
set to the nearest lower multiple of.
|
static SColor |
showSColorChooser(java.awt.Component parent)
Returns an SColor chosen from a pop-up JColorChooser dialog.
|
public static SColor colorForName(java.lang.String s)
s
- public static SColor colorForValue(int rgb)
rgb
- public static int quantityCached()
public static SColor blend(SColor color1, SColor color2, double coef)
color1
- The first colorcolor2
- The second colorcoef
- The percent towards the second color, as 0.0 to 1.0public static SColor randomBlend(SColor color1, SColor color2, double min, double max)
color1
- color2
- min
- The minimum percent towards the second color, as 0.0 to 1.0max
- The maximum percent towards the second color, as 0.0 to 1.0public static void emptyCache()
public static void setFloor(int value)
value
- public static SColor asSColor(int rgb)
rgb
- public static SColor asSColor(int r, int g, int b)
r
- g
- b
- public static SColor asSColor(java.awt.Color color)
color
- public static SColor dim(SColor color)
color
- public static SColor dimmer(SColor color)
color
- public static SColor dimmest(SColor color)
color
- public static SColor light(SColor color)
color
- public static SColor lighter(SColor color)
color
- public static SColor lightest(SColor color)
color
- public static SColor desaturated(SColor color)
color
- public static SColor desaturate(SColor color, double percent)
color
- percent
- The percent to desaturate, from 0.0 for none to 1.0 for
fully desaturatedpublic static java.util.ArrayList<SColor> asGradient(SColor color1, SColor color2)
color1
- color2
- public static java.util.ArrayList<SColor> pallet(java.lang.String name)
name
- public static SColor fromPallet(java.lang.String name, float percent)
name
- percent
- public static SColor showSColorChooser(java.awt.Component parent)
parent
- The component which is the parent of this dialogpublic static void addPallet(java.lang.String name, java.util.ArrayList<SColor> pallet)
name
- pallet
-