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

pub struct NeuQuant {
    // some fields omitted
}

Neural network color quantizer

Methods

impl NeuQuant

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

type Color = Rgba<u8>

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

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