(self, palette: &mut PalF)
| 40 | } |
| 41 | |
| 42 | pub fn finalize(self, palette: &mut PalF) -> f64 { |
| 43 | for (avg, (color, pop)) in self.averages.iter().zip(palette.iter_mut()).filter(|(_, (_, pop))| !pop.is_fixed()) { |
| 44 | let total = avg.total; |
| 45 | *pop = PalPop::new(total as f32); |
| 46 | if total > 0. && color.a != 0. { |
| 47 | *color = avg.sum.map(move |c| (c / total) as f32).into(); |
| 48 | } |
| 49 | } |
| 50 | self.weighed_diff_sum |
| 51 | } |
| 52 | |
| 53 | #[inline(never)] |
| 54 | pub(crate) fn iteration(hist: &mut HistogramInternal, palette: &mut PalF, adjust_weight: bool) -> Result<f64, Error> { |
no test coverage detected