[][src]Trait cichlid::color_util::ColorIterMut

pub trait ColorIterMut: Sized {
    fn fill(self, color: ColorRGB);
fn fade_to_black(self, fade_by: u8);
fn blur(self, blur_amount: u8); fn clear(self) { ... } }

Useful methods when iterating over ColorRGBs.

This is impl'd for any Iterator over &mut RGB. This includes both arrays and slices, the most common use case for this.

Examples

Operating Directly on an array of ColorRGBs:

use cichlid::{prelude::*, ColorRGB};

let mut colors = [ColorRGB::BlanchedAlmond; 100];

colors.fill(ColorRGB::Yellow);
colors.iter().for_each(|c| assert_eq!(*c, ColorRGB::Yellow));

Operating on slices is supported as well:

use cichlid::{prelude::*, ColorRGB};

let mut colors = [ColorRGB::Purple; 50];
let color_slice = &mut colors[0..40];

color_slice.clear();
color_slice.iter().for_each(|c| assert_eq!(*c, ColorRGB::Black));

Required methods

fn fill(self, color: ColorRGB)

Fills an entire Iterator with the specified color.

fn fade_to_black(self, fade_by: u8)

Fades all colors to black by the a fraction.

The fade_by parameter is interpreted as a fraction with a denominator of 255, of which itself is the numerator.

fn blur(self, blur_amount: u8)

Blurs colors by blur_amount.

A lower blur_amount means a less extreme blur. For example, a blur_amount of 64 is a moderate blur, while past 171 the blur is somewhat flickery.

This method does not retain brightness. Blurring will slowly fade all the colors to black.

Loading content...

Provided methods

fn clear(self)

Sets all colors to black.

Loading content...

Implementors

impl<'a, T: Sized + IntoIterator<Item = &'a mut ColorRGB>> ColorIterMut for T[src]

fn clear(self)[src]

Loading content...