pub struct ColorMap { /* private fields */ }Expand description
A piecewise-linear map from normalized scalar values to linear RGBA colors.
Self::sample evaluates the control points exactly on the CPU. The wgpu
heatmap renderer samples a documented 256-entry, 8-bit lookup table, so
transitions narrower than one LUT interval can be quantized away.
Implementations§
Source§impl ColorMap
impl ColorMap
Sourcepub fn new(stops: Vec<ColorStop>) -> Result<Self, ColorMapError>
pub fn new(stops: Vec<ColorStop>) -> Result<Self, ColorMapError>
Builds a color map from at least two strictly increasing stops.
Sourcepub fn linear(start: Color, end: Color) -> Result<Self, ColorMapError>
pub fn linear(start: Color, end: Color) -> Result<Self, ColorMapError>
Builds a two-color normalized gradient.
Sourcepub fn allocation_bytes(&self) -> usize
pub fn allocation_bytes(&self) -> usize
Returns CPU bytes currently allocated for retained color stops.
Trait Implementations§
impl StructuralPartialEq for ColorMap
Auto Trait Implementations§
impl Freeze for ColorMap
impl RefUnwindSafe for ColorMap
impl Send for ColorMap
impl Sync for ColorMap
impl Unpin for ColorMap
impl UnsafeUnpin for ColorMap
impl UnwindSafe for ColorMap
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