[−][src]Module cichlid::color_util
Various Functions and traits for colors.
The majority of these traits are not intended to be implemented by users. Rather, they are meant for allowing easy ways to fill iterators with color.
Importing
Importing can be done by one of the following ways:
use cichlid::*; use cichlid::prelude::*; use cichlid::color_util::ColorIterMut; use cichlid::color_util::ColorIterMut as _;
It is preferable to import that traits anonymously with use ... as _
. This is because
these traits are not meant to be implemented directly, so only the types implementing
the traits need to be imported.
Traits
ColorIterMut
:- General functions applying on iterators over
ColorRGB
's. - Examples of functions:
blur()
,fade_to_black()
,fill()
. - Implemented for all Iterators over
&mut ColorRGB
.
- General functions applying on iterators over
GradientFill
:- Fills a Gradient from one
HSV
to another using Linear Interpolation. - Implemented for any iterators implementing
ExactSizeIter
. - Also Generic over
Iterator::Item
for any item implementingFrom<HSV>
, meaning this method works on itorators over bothHSV
andColorRGB
.
- Fills a Gradient from one
GradientFillToInclusive
:- Same as
GradientFill
, but creates a gradient inclusive of the lastHSV
. This means that the last item iterated over will be garunteed to be the lastHSV
, rather than being the color before. - Generally Requires a
DoubleEndedIter
trait be implemented for implementee's type.
- Same as
GradientFillRGB
:- Works the same as
GradientFill
, but does a linear interpolation between twoColorRGBs
. - This results in a gradient that is a mathematically consistent transition, but isn't
as visually pleasing compared to doing Linear Interpolation with
HSV
s.
- Works the same as
GradientFillRGBToInclusive
:- The
GradientFillToInclusive
toGradientFillRGB
, as it fills up to and including the last color. - Also requires that the Iterator implements
DoubleEndedIter
.
- The
RainbowFill
:- Fills an Iterator over
&mut From<HSV>
with a rainbow pattern. This pattern repeats forever, starting at a specific hue and taking a user-defined step size for each new element.
- Fills an Iterator over
RainbowFillSingleCycle
:- Fills an Iterator with a full rainbow cycle.
Modules
gradient | Color gradient functions and impls. |
rainbow | Rainbow gradient impls. |
Enums
GradientDirection | Possible Directions around the color wheel a gradient can go. |
HueDirection | Possible Directions around the color wheel a hue can go. |
Traits
ColorIterMut | Useful methods when iterating over |
GradientFill | Fills an iterable object with a gradient from the |
GradientFillRGB | Fills an iterable object with a gradient from the |
GradientFillRGBToInclusive | Fills an iterable object with a gradient from the |
GradientFillToInclusive | Fills an iterable object with a gradient from the |
RainbowFill | Fills an iterable object with a rainbow hue of a desired step size. |
RainbowFillSingleCycle | Fills an iterable object with a single complete rainbow. |