|
ImageScience 3.0.0 | ||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectimagescience.color.Palette
public class Palette
A palette of 100 different colors.
Field Summary | |
---|---|
static int |
ARBITRARY
The arbitrary mode. |
static int |
SPECTRUM
The spectrum mode. |
Constructor Summary | |
---|---|
Palette()
Default constructor. |
|
Palette(int mode)
Mode constructor. |
Method Summary | |
---|---|
java.awt.Color |
get(int index)
Returns the color at the given index (modulo 100). |
int |
index(java.awt.Color color)
Returns the index of the given color. |
int |
mode()
Returns the palette mode. |
java.awt.Color |
next()
Returns the next color. |
void |
reset()
Resets the counter used by the next() method. |
void |
used(java.awt.Color color)
Marks the given color as used if it is in the palette. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int SPECTRUM
get(int)
method (with index running from 0
to 99
) and the next()
method both yield a 5x20 color spectrum (meaning 5 different tints of each of the 20 different colors sampled from the visible spectrum).
public static final int ARBITRARY
get(int)
method (with index running from 0
to 99
) and the next()
method both yield the same set of colors as in the spectrum mode, but put in arbitrary (yet fixed) order, such that the perceptual difference between successive colors is much larger.
Constructor Detail |
---|
public Palette()
public Palette(int mode)
mode
- The palette mode. Must be one of the static fields of this class.
java.lang.IllegalArgumentException
- If mode
is not one of the static fields of this class.Method Detail |
---|
public int mode()
public java.awt.Color get(int index)
index
- The index.
public int index(java.awt.Color color)
color
- The color.
color
is null
or it is not in the palette, the method returns -1.public java.awt.Color next()
public void used(java.awt.Color color)
next()
method until all colors have been used and a new cycle is started.
color
- The color.public void reset()
next()
method.
|
ImageScience 3.0.0 | ||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright (C) Erik Meijering. Permission to use this software and corresponding documentation for educational, research, and not-for-profit purposes, without a fee and without a signed licensing agreement, is granted, subject to the following terms and conditions.
IT IS NOT ALLOWED TO REDISTRIBUTE, SELL, OR LEASE THIS SOFTWARE, OR DERIVATIVE WORKS THEREOF, WITHOUT PERMISSION IN WRITING FROM THE COPYRIGHT HOLDER. THE COPYRIGHT HOLDER IS FREE TO MAKE VERSIONS OF THE SOFTWARE AVAILABLE FOR A FEE OR COMMERCIALLY ONLY.
IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OF ANY KIND WHATSOEVER, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE EXPRESS OR IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE AND CORRESPONDING DOCUMENTATION IS PROVIDED "AS IS". THE COPYRIGHT HOLDER HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.