[][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.
  • 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 implementing From<HSV>, meaning this method works on itorators over both HSV and ColorRGB.
  • GradientFillToInclusive:
    • Same as GradientFill, but creates a gradient inclusive of the last HSV. This means that the last item iterated over will be garunteed to be the last HSV, rather than being the color before.
    • Generally Requires a DoubleEndedIter trait be implemented for implementee's type.
  • GradientFillRGB:
    • Works the same asGradientFill, but does a linear interpolation between two ColorRGBs.
    • This results in a gradient that is a mathematically consistent transition, but isn't as visually pleasing compared to doing Linear Interpolation with HSVs.
  • GradientFillRGBToInclusive:
    • The GradientFillToInclusive to GradientFillRGB, as it fills up to and including the last color.
    • Also requires that the Iterator implements DoubleEndedIter.
  • 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.
  • 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 ColorRGBs.

GradientFill

Fills an iterable object with a gradient from the HSV values start to finish, exclusive of the finish.

GradientFillRGB

Fills an iterable object with a gradient from the ColorRGB values start to finish, exclusive of the finish.

GradientFillRGBToInclusive

Fills an iterable object with a gradient from the ColorRGB values start to finish, inclusive of the finish.

GradientFillToInclusive

Fills an iterable object with a gradient from the HSV values start to finish, inclusive of the finish.

RainbowFill

Fills an iterable object with a rainbow hue of a desired step size.

RainbowFillSingleCycle

Fills an iterable object with a single complete rainbow.