Struct exoquant::Remapper [] [src]

pub struct Remapper<'a, T: 'a + ColorSpace, D: 'a + Ditherer + ?Sized> { /* fields omitted */ }

A helper type to very slightly simplify remapping images using a Ditherer.

The plain remap function remaps a &[Color] to a Vec<u8>, while the remap_iter function remaps a Box<Iterator<Item = Color>> to a Box<Iterator<Item = u8>>. The _usize functions remap to usize instead of u8, in case you need palettes with more than 256 colors.

Examples

let ditherer = ditherer::FloydSteinberg::new();
let remapper = Remapper::new(&palette, &colorspace, &ditherer);
let indexed_image_data = remapper.remap(&image.pixels, image.width);
let ditherer = ditherer::FloydSteinberg::new();
let remapper = Remapper::new(&palette, &colorspace, &ditherer);
let iter = remapper.remap_iter(Box::new(image.pixels.iter().cloned()), image.width);
let indexed_image_data: Vec<u8> = iter.collect();

Methods

impl<'a, T: ColorSpace, D: Ditherer + ?Sized> Remapper<'a, T, D>
[src]

Create a new Remapper instance for the given palette, colorspace and ditherer.

Remap and dither a &[Color] to a Vec<u8>.

Remap and dither a &[Color] to a Vec<usize>.

Remap and dither a Box<Iterator<Item = Color>> to a Box<Iterator<Item = u8>>.

Remap and dither a Box<Iterator<Item = Color>> to a Box<Iterator<Item = usize>>.