[][src]Struct scarlet::colormap::GradientColorMap

pub struct GradientColorMap<T: ColorPoint> {
    pub start: T,
    pub end: T,
    pub normalization: NormalizeMapping,
    pub padding: (f64, f64),
}

A gradient colormap: a continuous, evenly-spaced shift between two colors A and B such that 0 maps to A, 1 maps to B, and any number in between maps to a weighted mix of them in a given coordinate space. Uses the gradient functions in the ColorPoint trait to complete this. Out-of-range values are simply clamped to the correct range: calling this on negative numbers will return A, and calling this on numbers larger than 1 will return B.

Fields

start: T

The start of the gradient. Calling this colormap on 0 or any negative number returns this color.

end: T

The end of the gradient. Calling this colormap on 1 or any larger number returns this color.

normalization: NormalizeMapping

Any additional added nonlinearity imposed on the gradient: for example, a cube root mapping emphasizes differences in the low end of the range.

padding: (f64, f64)

Any desired padding: offsets introduced that artificially shift the limits of the range. Expressed as (new_min, new_max), where both are floats and new_min < new_max. For example, having padding of (1/8, 1) would remove the lower eighth of the color map while keeping the overall map smooth and continuous. Padding of (0., 1.) is the default and normal behavior.

Methods

impl<T: ColorPoint> GradientColorMap<T>[src]

pub fn new_linear(start: T, end: T) -> GradientColorMap<T>[src]

Constructs a new linear GradientColorMap, without padding, from two colors.

pub fn new_cbrt(start: T, end: T) -> GradientColorMap<T>[src]

Constructs a new cube root GradientColorMap, without padding, from two colors.

Trait Implementations

impl<T: Clone + ColorPoint> Clone for GradientColorMap<T>[src]

impl<T: ColorPoint> ColorMap<T> for GradientColorMap<T>[src]

impl<T: Debug + ColorPoint> Debug for GradientColorMap<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for GradientColorMap<T> where
    T: RefUnwindSafe

impl<T> Send for GradientColorMap<T> where
    T: Send

impl<T> Sync for GradientColorMap<T> where
    T: Sync

impl<T> Unpin for GradientColorMap<T> where
    T: Unpin

impl<T> UnwindSafe for GradientColorMap<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.