pub struct ContinuousColorScale { /* private fields */ }Expand description
A continuous color scale that linearly interpolates between color stops.
Unlike DiscreteColorScale, this scale produces smooth color gradients
between control points. This is useful for products where smooth transitions
are more informative than discrete steps.
§Example
use nexrad_render::{ColorStop, ContinuousColorScale, Color};
let scale = ContinuousColorScale::new(vec![
ColorStop::new(0.0, Color::rgb(0.0, 0.0, 1.0)), // Blue at 0
ColorStop::new(50.0, Color::rgb(0.0, 1.0, 0.0)), // Green at 50
ColorStop::new(100.0, Color::rgb(1.0, 0.0, 0.0)), // Red at 100
]);
// Value 25 produces a blue-green blend
let color = scale.color(25.0);Implementations§
Source§impl ContinuousColorScale
impl ContinuousColorScale
Sourcepub fn new(stops: Vec<ColorStop>) -> Self
pub fn new(stops: Vec<ColorStop>) -> Self
Creates a new continuous color scale from color stops.
Stops are automatically sorted by value (lowest to highest).
Trait Implementations§
Source§impl Clone for ContinuousColorScale
impl Clone for ContinuousColorScale
Source§fn clone(&self) -> ContinuousColorScale
fn clone(&self) -> ContinuousColorScale
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ContinuousColorScale
impl Debug for ContinuousColorScale
Source§impl From<ContinuousColorScale> for ColorScale
impl From<ContinuousColorScale> for ColorScale
Source§fn from(scale: ContinuousColorScale) -> Self
fn from(scale: ContinuousColorScale) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for ContinuousColorScale
impl RefUnwindSafe for ContinuousColorScale
impl Send for ContinuousColorScale
impl Sync for ContinuousColorScale
impl Unpin for ContinuousColorScale
impl UnsafeUnpin for ContinuousColorScale
impl UnwindSafe for ContinuousColorScale
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more