fn new(src: &[u8]) -> Self {
Self { r: src[0], g: src[1], b: src[2] }
}
- fn to_rgb(&self) -> [u8; 3] {
+ fn to_rgb(self) -> [u8; 3] {
[self.r, self.g, self.b]
}
fn dist(&self, pix: Pixel) -> u32 {
let ofmt = dbuf.get_info().get_format();
let dst = dbuf.get_data_mut().unwrap();
- pixels.truncate(0);
+ pixels.clear();
if !ifmt.is_unpacked() {
let esize = ifmt.elem_size as usize;
let coffs = [ifmt.comp_info[0].unwrap().comp_offs as usize, ifmt.comp_info[1].unwrap().comp_offs as usize, ifmt.comp_info[2].unwrap().comp_offs as usize];