Struct exoquant::ColorMap [] [src]

pub struct ColorMap {
    // some fields omitted
}

A data structure for fast nearest color lookups in a palette.

Methods

impl ColorMap
[src]

fn new<T: ColorSpace>(colors: &[Color], colorspace: &T) -> ColorMap

Create a ColorMap from a slice of Colors.

fn from_float_colors(colors: Vec<Colorf>) -> ColorMap

Create a ColorMap from float colors.

fn find_nearest(&self, color: Colorf) -> usize

Returns the index of the nearest color in the palette.

fn neighbor_distance(&self, index: usize) -> f64

Returns the distance to the closest neighbor color of a palette entry given by index.

fn neighbors(&self, index: usize) -> &[usize]

Returns the list of neighbors (as indices) for a palette color given by index.

fn float_color(&self, index: usize) -> Colorf

Returns the palette color for the given index.

fn num_colors(&self) -> usize

Returns the number of colors in the palette.