java.lang.Object
imagingbook.common.color.iterate.FiniteLinearColorSequencer
- All Implemented Interfaces:
ColorSequencer,Iterator<Color>
- Direct Known Subclasses:
FiniteRandomColorSequencer
This class defines methods for iterating over an ordered set of AWT colors. The color set can be constructed from
individual AWT colors (see FiniteLinearColorSequencer(Color...)) or an enum class implementing
ColorEnumeration (see FiniteLinearColorSequencer(Class)).
Usage examples:
// from individual colors (or array of colors):
ColorSequencer iter1 = new FiniteLinearColorSequencer(Color.blue, Color.green, Color.red);
for (int i = 0; i < 10; i++) {
Color c = iter1.next();
// use color c
}
// from enum type:
FiniteLinearColorSequencer iter2 = new FiniteLinearColorSequencer(BasicAwtColor.class);
iter2.reset(5);
for (int i = 0; i < 10; i++) {
Color c = iter2.nextRandom();
// use color c
}
- Version:
- 2022/04/06
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFiniteLinearColorSequencer(Color... colors) FiniteLinearColorSequencer(Class<? extends ColorEnumeration> clazz) -
Method Summary
Modifier and TypeMethodDescriptiongetColor(int idx) Color[]next()voidreset()Reset the iterator, such that the color returned by the following call tonext()has index 0.voidreset(int offset) Reset the iterator such that the index of the item returned by the following call tonext()has the specified start index.intsize()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface imagingbook.common.color.iterate.ColorSequencer
hasNextMethods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Field Details
-
colorArray
-
next
-
-
Constructor Details
-
FiniteLinearColorSequencer
-
FiniteLinearColorSequencer
-
-
Method Details