pub trait ColorMap {
type Color;
// Required methods
fn index_of(&self, color: &Self::Color) -> usize;
fn map_color(&self, color: &mut Self::Color);
// Provided methods
fn lookup(&self, index: usize) -> Option<Self::Color> { ... }
fn has_lookup(&self) -> bool { ... }
}
Expand description
A color map
Required Associated Types§
type Color
type Color
The color type on which the map operates on
Required Methods§
Provided Methods§
fn lookup(&self, index: usize) -> Option<Self::Color>
fn lookup(&self, index: usize) -> Option<Self::Color>
Looks up color by index in the color map. If idx
is out of range for the color map, or
ColorMap
doesn’t implement lookup
None
is returned.
fn has_lookup(&self) -> bool
fn has_lookup(&self) -> bool
Determine if this implementation of ColorMap
overrides the default lookup
.