diff options
author | Devon Sawatsky <novedevo@gmail.com> | 2021-09-27 21:10:43 -0700 |
---|---|---|
committer | gennyble <gen@nyble.dev> | 2021-09-28 23:05:18 +0000 |
commit | a198a047c6ac7985b838b98bb5f0fdf32a328cd5 (patch) | |
tree | 1ac4e926a105c923cecf41b5e958cb13bfff7fc5 /src | |
parent | 1b948cafcc32d48413a46540caa51b9e9084c7d1 (diff) | |
download | colorsquash-a198a047c6ac7985b838b98bb5f0fdf32a328cd5.tar.gz colorsquash-a198a047c6ac7985b838b98bb5f0fdf32a328cd5.zip |
genericize quantizer
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index f1b23fa..cbd9c43 100644 --- a/src/main.rs +++ b/src/main.rs @@ -49,7 +49,10 @@ fn main() { image.save(outname).expect("Failed to write out"); } -fn quantize(pixels: Pixels<Rgb<u8>>) -> Vec<Rgb<u8>> { +fn quantize<'a, T>(pixels: T) -> Vec<Rgb<u8>> +where + T: Iterator<Item = &'a Rgb<u8>>, +{ let mut colors: HashMap<Rgb<u8>, usize> = HashMap::new(); //count pixels |