|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttoxi.color.ColorList
public class ColorList
A container class of concrete colors. ColorLists can be built manually and
are also created when working with ColorRange
s. The class has various
methods to manipulate all colors in the list in parallel, as well as sort
them by various criteria.
ColorRange
,
AccessCriteria
Constructor Summary | |
---|---|
ColorList()
Creates an empty list. |
|
ColorList(java.util.Collection<TColor> colors)
Creates a ColorList by wrapping the given ArrayList of colors. |
|
ColorList(ColorList list)
Creates a deep copy of the given ColorList. |
|
ColorList(int[] argbArray)
Creates a new color list from the array of ARGB int values. |
|
ColorList(ReadonlyTColor... colorArray)
Creates new ColorList from the given number of colors. |
Method Summary | |
---|---|
ColorList |
add(ReadonlyTColor c)
Adds the given color to the list |
ColorList |
addAll(java.util.Collection<TColor> collection)
Adds all entries of the TColor collection to the list (shallow copy only, manipulating the new list will modify the original colors). |
ColorList |
adjustBrightness(float step)
Adjusts the brightness component of all list colors by the given amount. |
ColorList |
adjustSaturation(float step)
Adjusts the saturation component of all list colors by the given amount. |
ColorList |
clusterSort(AccessCriteria clusterCriteria,
AccessCriteria subClusterCriteria,
int numClusters,
boolean isReversed)
Sorts the list based on two criteria to create clusters/segments within the list. |
ColorList |
complement()
Switches all list colors to their complementary color. |
boolean |
contains(ReadonlyTColor color)
Checks if the given color is part of the list. |
static ColorList |
createFromARGBArray(int[] pixels,
int num,
boolean uniqueOnly)
Factory method. |
static ColorList |
createFromARGBArray(int[] pixels,
int num,
boolean uniqueOnly,
int maxIterations)
Factory method. |
static ColorList |
createUsingStrategy(ColorTheoryStrategy strategy,
TColor c)
Factory method. |
static ColorList |
createUsingStrategy(java.lang.String name,
TColor c)
Factory method. |
TColor |
get(int i)
Returns the color at the given index. |
ReadonlyTColor |
getAverage()
Calculates and returns the average color of the list. |
ColorList |
getBlended(float amount)
Creates a new ColorList by blending all colors in the list with each other (successive indices only) |
TColor |
getDarkest()
Finds and returns the darkest color of the list. |
ReadonlyTColor |
getLightest()
Finds and returns the lightest (luminance) color of the list. |
TColor |
getRandom()
|
ColorList |
getReverse()
Returns a reversed copy of the current list. |
ColorList |
invert()
Inverts all colors in the list. |
java.util.Iterator<TColor> |
iterator()
Returns an iterator over the internal list. |
ColorList |
reverse()
Reverses the current order of the list. |
ColorList |
rotateRYB(float theta)
Rotates the hues of all colors in the list by the given amount. |
ColorList |
rotateRYB(int angle)
Rotates the hues of all colors in the list by the given amount. |
int |
size()
|
ColorList |
sort()
Convenience method. |
ColorList |
sortByComparator(java.util.Comparator<ReadonlyTColor> comp,
boolean isReversed)
Sorts the list using the given comparator. |
ColorList |
sortByCriteria(AccessCriteria criteria,
boolean isReversed)
Sorts the list using the given AccessCriteria . |
ColorList |
sortByDistance(boolean isReversed)
Sorts the list by relative distance to each predecessor, starting with the darkest color in the list. |
ColorList |
sortByDistance(DistanceProxy proxy,
boolean isReversed)
Sorts the list by relative distance to each predecessor, starting with the darkest color in the list. |
ColorList |
sortByProximityTo(ReadonlyTColor target,
boolean isReversed)
Sorts the list by proximity to the given target color (using RGB distance metrics). |
ColorList |
sortByProximityTo(ReadonlyTColor target,
DistanceProxy proxy,
boolean isReversed)
Sorts the list by proximity to the given target color using the given DistanceProxy implementation. |
int[] |
toARGBArray()
Creates an ARGB integer array of the list items. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ColorList()
public ColorList(java.util.Collection<TColor> colors)
colors
- public ColorList(ColorList list)
list
- source listpublic ColorList(int[] argbArray)
argbArray
- public ColorList(ReadonlyTColor... colorArray)
colorArray
- Method Detail |
---|
public static final ColorList createFromARGBArray(int[] pixels, int num, boolean uniqueOnly)
pixels
- int array of ARGB pixelsnum
- number of colors samples (clipped automatically to number of
pixels in the image)uniqueOnly
- flag if only unique samples are to be taken (doesn't guarantee
unique colors though)
public static final ColorList createFromARGBArray(int[] pixels, int num, boolean uniqueOnly, int maxIterations)
pixels
- int array of ARGB pixelsnum
- number of colors samples (clipped automatically to number of
pixels in the image)uniqueOnly
- flag if only unique samples are to be taken (doesn't guarantee
unique colors though)maxIterations
- max number of attempts to find a unique color
public static final ColorList createUsingStrategy(ColorTheoryStrategy strategy, TColor c)
ColorTheoryStrategy
instance and the given source color.
strategy
- c
-
public static final ColorList createUsingStrategy(java.lang.String name, TColor c)
ColorTheoryStrategy
name and the given source color.
name
- c
-
public ColorList add(ReadonlyTColor c)
c
-
public ColorList addAll(java.util.Collection<TColor> collection)
collection
-
public ColorList adjustBrightness(float step)
step
- adjustment value
public ColorList adjustSaturation(float step)
step
- adjustment value
public ColorList clusterSort(AccessCriteria clusterCriteria, AccessCriteria subClusterCriteria, int numClusters, boolean isReversed)
clusterCriteria
- main sort criteriasubClusterCriteria
- secondary sort criterianumClusters
- number of clustersisReversed
- true, if reversed sort
public ColorList complement()
public boolean contains(ReadonlyTColor color)
color
-
public TColor get(int i)
i
-
public ReadonlyTColor getAverage()
public ColorList getBlended(float amount)
amount
- blend amount
public TColor getDarkest()
public ReadonlyTColor getLightest()
public TColor getRandom()
public ColorList getReverse()
public ColorList invert()
public java.util.Iterator<TColor> iterator()
iterator
in interface java.lang.Iterable<TColor>
public ColorList reverse()
public ColorList rotateRYB(float theta)
theta
- rotation angle in radians
public ColorList rotateRYB(int angle)
angle
- rotation angle in degrees
public int size()
public ColorList sort()
public ColorList sortByComparator(java.util.Comparator<ReadonlyTColor> comp, boolean isReversed)
comp
- comparatorisReversed
- true, if reversed sort
public ColorList sortByCriteria(AccessCriteria criteria, boolean isReversed)
AccessCriteria
.
criteria
- sort criteriaisReversed
- true, if reversed sort
public ColorList sortByDistance(boolean isReversed)
isReversed
- true, if list is to be sorted in reverse.
public ColorList sortByDistance(DistanceProxy proxy, boolean isReversed)
isReversed
- true, if list is to be sorted in reverse.
public ColorList sortByProximityTo(ReadonlyTColor target, boolean isReversed)
target
- colorisReversed
- true, if reverse sorted
sortByProximityTo(ReadonlyTColor, DistanceProxy, boolean)
public ColorList sortByProximityTo(ReadonlyTColor target, DistanceProxy proxy, boolean isReversed)
DistanceProxy
implementation.
target
- colorproxy
- distance metricsisReversed
- true, if reverse sorted
public int[] toARGBArray()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |