Trait scarlet::colormap::ColorMap [] [src]

pub trait ColorMap<T: Color + Sized> {
    fn transform_single(&self, _: f64) -> T;

    fn transform<U: IntoIterator<Item = f64>>(&self, inputs: U) -> Vec<T> { ... }
}

A trait that models a colormap, a continuous mapping of the numbers between 0 and 1 to colors. Any color output format is supported, but it must be consistent.

Required Methods

Maps a given number between 0 and 1 to a given output Color. This should never fail or panic except for NaN and similar: there should be some Color that marks out-of-range data.

Provided Methods

Maps a given collection of numbers between 0 and 1 to an iterator of Colors. Does not evaluate lazily, because the colormap could have some sort of state that changes between iterations otherwise.

Implementors