public class ColorIterator
extends java.lang.Object
implements java.util.Iterator<java.awt.Color>
Modifier and Type | Class and Description |
---|---|
static class |
ColorIterator.ADefaultStepping
Just for protected internal float stepping.
|
static class |
ColorIterator.AlphaStepper
A stepping model that steps on the alpha channel of the HSB color space.
|
static class |
ColorIterator.APiggyBackStepper
Base class for stepping models that may step in each direction of the Hue
Saturation Luminance color space.
|
static class |
ColorIterator.HSBStepper
Performs hue steps until it has walked the whole hue line, then performs a
saturation step to start with hue steps again.
|
static class |
ColorIterator.HSStepper
Performs hue steps until it has walked the whole hue line, then performs a
saturation step to start with hue steps again.
|
static class |
ColorIterator.HueStepper
A stepper that walks along the hue line of the color space.
|
static interface |
ColorIterator.ISteppingModel
Defines the strategy of walking through the HSB color space.
|
static class |
ColorIterator.LuminanceStepper
A stepping model that steps on the luminance line of the HSB color space.
|
static class |
ColorIterator.SaturationStepper
A stepping model that steps on the saturation line of the HSB color space.
|
Modifier and Type | Field and Description |
---|---|
protected HSBColor |
m_iterate
Reference to the currently iterated color.
|
protected HSBColor |
m_startColor
The starting color which is also used to detect if a whole iteration has
been performed.
|
Constructor and Description |
---|
ColorIterator()
Creates an instance that starts with a red color and walks the hue line
with a
ColorIterator.HueStepper . |
ColorIterator(java.awt.Color startColor,
ColorIterator.ISteppingModel stepper)
Creates an instance that starts with the given color and uses the given
stepper for iteration.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
java.awt.Color |
getStartColor()
Returns the starting color which is also used to detect if a whole
iteration has been performed.
|
int |
hashCode() |
boolean |
hasNext()
Returns true if more colors are available.
|
boolean |
isAscendingDirection()
Returns the ascendingDirection.
|
static void |
main(java.lang.String[] args)
Main entry for a test application.
|
java.awt.Color |
next()
Returns instances of java.awt.Color or throws a NoSuchElementException, if
iterator has finished.
|
void |
remove()
Nothing is done here.
|
void |
reset()
Resets the ColorIterator.
|
void |
setAscendingDirection(boolean ascendingDirection)
Sets whether the color space should be iterated in ascending direction (+
operations) or descending direction(- operations).
|
void |
setStartColor(java.awt.Color startColor)
Sets the starting color which is also used to detect if a whole iteration
has been performed.
|
void |
setSteps(int steps)
Sets the amount of colors to iterate over.
|
protected HSBColor m_iterate
protected HSBColor m_startColor
public ColorIterator()
ColorIterator.HueStepper
.
public ColorIterator(java.awt.Color startColor, ColorIterator.ISteppingModel stepper)
startColor
- the color to start the iteration with.stepper
- the stepping model to use.public static void main(java.lang.String[] args)
args
- ignored.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public final java.awt.Color getStartColor()
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public boolean hasNext()
hasNext
in interface java.util.Iterator<java.awt.Color>
Iterator.hasNext()
public final boolean isAscendingDirection()
setAscendingDirection(boolean)
public java.awt.Color next() throws java.util.NoSuchElementException
next
in interface java.util.Iterator<java.awt.Color>
java.util.NoSuchElementException
- if hasNext()
returns false.public void remove()
remove
in interface java.util.Iterator<java.awt.Color>
public void reset()
public final void setAscendingDirection(boolean ascendingDirection)
ascendingDirection
- if true the color space will be iterated in ascending direction.public final void setStartColor(java.awt.Color startColor)
startColor
- the starting color which is also used to detect if a whole
iteration has been performed.public void setSteps(int steps)
steps
- the amount of steps to take in the color space.Copyright © 2001 - 2010 LGPL, All Rights Footloose.