[−][src]Struct scarlet::colormap::GradientColorMap
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]
fn clone(&self) -> GradientColorMap<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: ColorPoint> ColorMap<T> for GradientColorMap<T>
[src]
fn transform_single(&self, x: f64) -> T
[src]
fn transform<U: IntoIterator<Item = f64>>(&self, inputs: U) -> Vec<T>
[src]
impl<T: Debug + ColorPoint> Debug for GradientColorMap<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for GradientColorMap<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for GradientColorMap<T> where
T: Send,
T: Send,
impl<T> Sync for GradientColorMap<T> where
T: Sync,
T: Sync,
impl<T> Unpin for GradientColorMap<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for GradientColorMap<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,