image::imageops::colorops

Trait ColorMap

source
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§

source

type Color

The color type on which the map operates on

Required Methods§

source

fn index_of(&self, color: &Self::Color) -> usize

Returns the index of the closest match of color in the color map.

source

fn map_color(&self, color: &mut Self::Color)

Maps color to the closest color in the color map.

Provided Methods§

source

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.

source

fn has_lookup(&self) -> bool

Determine if this implementation of ColorMap overrides the default lookup.

Implementations on Foreign Types§

source§

impl ColorMap for NeuQuant

source§

fn has_lookup(&self) -> bool

Indicate NeuQuant implements lookup.

source§

type Color = Rgba<u8>

source§

fn index_of(&self, color: &Rgba<u8>) -> usize

source§

fn lookup(&self, idx: usize) -> Option<Self::Color>

source§

fn map_color(&self, color: &mut Rgba<u8>)

Implementors§