|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttoxi.color.ColorRange
public class ColorRange
A ColorRange is a set of contraints to specify possible ranges for hue,
saturation, brightness and alpha independently and use these as creation
rules for new TColor
s or ColorList
s. The class comes with 11
preset ranges reflecting common demands and color characters. You can also
construct new ranges and manually add additional constraints. Unless the
constraints in a range are very narrow the class will always create random
variations within the constraints. Please see the examples for further
details.
ColorRange
s are a key ingredient for defining ColorTheme
s but
can also be used individually.
Field Summary | |
---|---|
static ColorRange |
BRIGHT
Shade definition: saturation 80-100%, brightness: 80-100% |
static ColorRange |
COOL
Shade definition: saturation 5-20%, brightness: 90-100% |
static ColorRange |
DARK
Shade definition: saturation 70-100%, brightness: 15-40% |
static float |
DEFAULT_VARIANCE
Default hue variance for getColor(ReadonlyTColor, float) |
static ColorRange |
FRESH
Shade definition: saturation 40-80%, brightness: 80-100% |
static ColorRange |
HARD
Shade definition: saturation 90-100%, brightness: 40-100% |
static ColorRange |
INTENSE
Shade definition: saturation 90-100%, brightness: 20-35% or 80-100% |
static ColorRange |
LIGHT
Shade definition: saturation 30-70%, brightness: 90-100% |
static ColorRange |
NEUTRAL
Shade definition: saturation 25-35%, brightness: 30-70% |
static java.util.HashMap<java.lang.String,ColorRange> |
PRESETS
List of ColorRange presets. |
static ColorRange |
SOFT
Shade definition: saturation 20-30%, brightness: 60-90% |
static ColorRange |
WARM
Shade definition: saturation 60-90%, brightness: 40-90% |
static ColorRange |
WEAK
Shade definition: saturation 15-30%, brightness: 70-100% |
Constructor Summary | |
---|---|
ColorRange(ColorList list)
Constructs a new range using the given colors as HSV constraints. |
|
ColorRange(toxi.util.datatypes.FloatRange hue,
toxi.util.datatypes.FloatRange sat,
toxi.util.datatypes.FloatRange bri,
toxi.util.datatypes.FloatRange alpha,
toxi.util.datatypes.FloatRange black,
toxi.util.datatypes.FloatRange white,
java.lang.String name)
Constructs a new range with the supplied constraints (if an HSV argument is null, a range of 0.0 ... |
|
ColorRange(toxi.util.datatypes.FloatRange hue,
toxi.util.datatypes.FloatRange sat,
toxi.util.datatypes.FloatRange bri,
toxi.util.datatypes.FloatRange alpha,
java.lang.String name)
Constructs a new range with the supplied constraints (if an argument is null, a range of 0.0 ... |
|
ColorRange(toxi.util.datatypes.FloatRange hue,
toxi.util.datatypes.FloatRange sat,
toxi.util.datatypes.FloatRange bri,
java.lang.String name)
Constructs a new range with the supplied constraints (if an argument is null, a range of 0.0 ... |
|
ColorRange(Hue hue)
Constructs a new range using the given hue as constraint, but saturation and brightness are fully flexible. |
|
ColorRange(ReadonlyTColor c)
Constructs a new range using the hue of the given color as hue constraint, but saturation and brightness are fully flexible. |
Method Summary | |
---|---|
ColorRange |
add(ColorRange range)
Adds the contraints of the given range to this range and forms unions for the black and white point ranges. |
ColorRange |
add(ReadonlyTColor c)
Adds the HSV color components as constraints. |
ColorRange |
addAlphaRange(float min,
float max)
Adds the range between min-max as possible alpha values for this range. |
ColorRange |
addAlphaRange(toxi.util.datatypes.FloatRange alpha)
Adds an additional alpha constraint. |
ColorRange |
addBrightnessRange(float min,
float max)
Adds the range between min-max as possible brightness values for this range. |
ColorRange |
addBrightnessRange(toxi.util.datatypes.FloatRange bri)
Adds an additional brightness constraint. |
ColorRange |
addHue(Hue hue)
Add the given hue as hue constraint. |
ColorRange |
addHueRange(float min,
float max)
Adds the range between min-max as possible hue values for this range. |
ColorRange |
addHueRange(toxi.util.datatypes.FloatRange hue)
Adds an additional hue constraint. |
ColorRange |
addSaturationRange(float min,
float max)
Adds the range between min-max as possible saturation values for this range. |
ColorRange |
addSaturationRange(toxi.util.datatypes.FloatRange sat)
Adds an additional saturation constraint. |
boolean |
contains(ReadonlyTColor c)
Checks if all HSVA components of the given color are within the constraints defined for this range. |
ColorRange |
copy()
Creates a shallow copy of the range. |
ColorRange |
copy(ReadonlyTColor c,
float variance)
Creates a copy of the range but overrides the hue and alpha constraints taken from the given color (if specified). |
TColor |
getColor()
Creates a new color based on the flexible constraints of the range. |
TColor |
getColor(Hue hue)
Creates a new shade of the given hue based on the other constraints of the range. |
TColor |
getColor(ReadonlyTColor c,
float variance)
Creates a new color based on the constraints defined in the range. |
ColorList |
getColors(int num)
Creates a new ColorList of colors based on the constraints of
this range. |
ColorList |
getColors(ReadonlyTColor c,
int num,
float variance)
Creates a new ColorList of shades of the given TColor
based on the other constraints of the range. |
TColor |
getGrayscale(float brightness,
float variance)
Creates a new shade of gray based on the input brightness and the black and white constraints of the range. |
java.lang.String |
getName()
|
static ColorRange |
getPresetForName(java.lang.String name)
Retrieves one of the predefined ranges by name. |
ColorRange |
getSum(ColorRange range)
Creates a copy of the current range and adds the given one to it. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final float DEFAULT_VARIANCE
getColor(ReadonlyTColor, float)
public static final ColorRange LIGHT
public static final ColorRange DARK
public static final ColorRange BRIGHT
public static final ColorRange WEAK
public static final ColorRange NEUTRAL
public static final ColorRange FRESH
public static final ColorRange SOFT
public static final ColorRange HARD
public static final ColorRange WARM
public static final ColorRange COOL
public static final ColorRange INTENSE
public static final java.util.HashMap<java.lang.String,ColorRange> PRESETS
Constructor Detail |
---|
public ColorRange(ColorList list)
list
- list base colorspublic ColorRange(toxi.util.datatypes.FloatRange hue, toxi.util.datatypes.FloatRange sat, toxi.util.datatypes.FloatRange bri, toxi.util.datatypes.FloatRange alpha, toxi.util.datatypes.FloatRange black, toxi.util.datatypes.FloatRange white, java.lang.String name)
hue
- sat
- bri
- alpha
- black
- white
- name
- public ColorRange(toxi.util.datatypes.FloatRange hue, toxi.util.datatypes.FloatRange sat, toxi.util.datatypes.FloatRange bri, toxi.util.datatypes.FloatRange alpha, java.lang.String name)
hue
- min/max hue rangesat
- min/max saturation rangebri
- min/max brightness rangealpha
- min/max alpha range (if null, initialized to 100% only)name
- public ColorRange(toxi.util.datatypes.FloatRange hue, toxi.util.datatypes.FloatRange sat, toxi.util.datatypes.FloatRange bri, java.lang.String name)
hue
- min/max hue rangesat
- min/max saturation rangebri
- min/max brightness rangename
- public ColorRange(Hue hue)
hue
- base huepublic ColorRange(ReadonlyTColor c)
c
- base colorMethod Detail |
---|
public static ColorRange getPresetForName(java.lang.String name)
name
-
public ColorRange add(ColorRange range)
range
- color range to add
public ColorRange add(ReadonlyTColor c)
c
- color to use as constraint
public ColorRange addAlphaRange(float min, float max)
min
- max
-
public ColorRange addAlphaRange(toxi.util.datatypes.FloatRange alpha)
alpha
- min/max alpha values
public ColorRange addBrightnessRange(float min, float max)
min
- max
-
public ColorRange addBrightnessRange(toxi.util.datatypes.FloatRange bri)
bri
- min/max brightness values
public ColorRange addHue(Hue hue)
hue
-
public ColorRange addHueRange(float min, float max)
min
- max
-
public ColorRange addHueRange(toxi.util.datatypes.FloatRange hue)
hue
- min/max hue values
public ColorRange addSaturationRange(float min, float max)
min
- max
-
public ColorRange addSaturationRange(toxi.util.datatypes.FloatRange sat)
sat
- min/max saturation values
public boolean contains(ReadonlyTColor c)
c
- color to check
public ColorRange copy()
public ColorRange copy(ReadonlyTColor c, float variance)
c
- color, if the new range is to be used to create specific
shades of that color onlyvariance
- hue variance (use DEFAULT_VARIANCE
for default)
public TColor getColor()
public TColor getColor(Hue hue)
hue
-
public TColor getColor(ReadonlyTColor c, float variance)
c
- variance
-
public ColorList getColors(int num)
ColorList
of colors based on the constraints of
this range.
num
- number of colors to create
getColor()
public ColorList getColors(ReadonlyTColor c, int num, float variance)
ColorList
of shades of the given TColor
based on the other constraints of the range.
c
- base colornum
- number of colors to createvariance
- hue variance
getColor(ReadonlyTColor, float)
public TColor getGrayscale(float brightness, float variance)
brightness
- input brightnessvariance
- hue variance (this might seem irrevelant, but might be
important if the created color is being saturated later on)
public java.lang.String getName()
public ColorRange getSum(ColorRange range)
range
- range to add
add(ColorRange)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |