Struct image::math::nq::NeuQuant [] [src]

pub struct NeuQuant {
    // some fields omitted
}

Neural network color quantizer

Methods

impl NeuQuant
[src]

fn new(samplefac: i32, colors: usize, pixels: &[u8]) -> Self

Creates a new neuronal network and trains it with the supplied data

fn init(&mut self, pixels: &[u8])

Initializes the neuronal network and trains it with the supplied data

fn map_pixel(&self, pixel: &mut [u8])

Maps the pixel in-place to the best-matching color in the color map

fn index_of(&self, pixel: &[u8]) -> usize

Finds the best-matching index in the color map for pixel

Trait Implementations

impl ColorMap for NeuQuant
[src]

type Color = Rgba<u8>

The color type on which the map operates on

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

Returns the index of the closed match of color in the color map. Read more

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

Maps color to the closes color in the color map.