Package info.monitorenter.gui.util
Class ColorIterator
java.lang.Object
info.monitorenter.gui.util.ColorIterator
Iterator of the color space.
- Version:
- $Revision: 1.10 $
- Author:
- Achim Westermann
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Just for protected internal float stepping.static class
A stepping model that steps on the alpha channel of the HSB color space.static class
Base class for stepping models that may step in each direction of the Hue Saturation Luminance color space.static class
Performs hue steps until it has walked the whole hue line, then performs a saturation step to start with hue steps again.static class
Performs hue steps until it has walked the whole hue line, then performs a saturation step to start with hue steps again.static class
A stepper that walks along the hue line of the color space.static interface
Defines the strategy of walking through the HSB color space.static class
A stepping model that steps on the luminance line of the HSB color space.static class
A stepping model that steps on the saturation line of the HSB color space. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates an instance that starts with a red color and walks the hue line with aColorIterator.HueStepper
.ColorIterator
(Color startColor, ColorIterator.ISteppingModel stepper) Creates an instance that starts with the given color and uses the given stepper for iteration. -
Method Summary
Modifier and TypeMethodDescriptionboolean
final Color
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.final boolean
Returns the ascendingDirection.static void
Main entry for a test application.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.final void
setAscendingDirection
(boolean ascendingDirection) Sets whether the color space should be iterated in ascending direction (+ operations) or descending direction(- operations).final void
setStartColor
(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.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
m_iterate
Reference to the currently iterated color. -
m_startColor
The starting color which is also used to detect if a whole iteration has been performed.
-
-
Constructor Details
-
ColorIterator
public ColorIterator()Creates an instance that starts with a red color and walks the hue line with aColorIterator.HueStepper
. -
ColorIterator
Creates an instance that starts with the given color and uses the given stepper for iteration.- Parameters:
startColor
- the color to start the iteration with.stepper
- the stepping model to use.
-
-
Method Details
-
main
Main entry for a test application.- Parameters:
args
- ignored.
-
equals
-
getStartColor
Returns the starting color which is also used to detect if a whole iteration has been performed.- Returns:
- the starting color which is also used to detect if a whole iteration has been performed.
-
hashCode
public int hashCode() -
hasNext
public boolean hasNext()Returns true if more colors are available. -
isAscendingDirection
public final boolean isAscendingDirection()Returns the ascendingDirection.- Returns:
- the ascendingDirection
- See Also:
-
next
Returns instances of java.awt.Color or throws a NoSuchElementException, if iterator has finished.- Specified by:
next
in interfaceIterator<Color>
- Returns:
- the next available Color.
- Throws:
NoSuchElementException
- ifhasNext()
returns false.
-
remove
public void remove()Nothing is done here. Do you really want to remove a color from the color circle model? -
reset
public void reset()Resets the ColorIterator. It will be able to start a new iteration over the color space. -
setAscendingDirection
public final void setAscendingDirection(boolean ascendingDirection) Sets whether the color space should be iterated in ascending direction (+ operations) or descending direction(- operations).- Parameters:
ascendingDirection
- if true the color space will be iterated in ascending direction.
-
setStartColor
Sets the starting color which is also used to detect if a whole iteration has been performed.- Parameters:
startColor
- the starting color which is also used to detect if a whole iteration has been performed.
-
setSteps
public void setSteps(int steps) Sets the amount of colors to iterate over.- Parameters:
steps
- the amount of steps to take in the color space.
-