Skip to main content

downscale

Function downscale 

Source
pub fn downscale(width: u32, height: u32, rgba: &[u8], size: u32) -> Vec<u8> ⓘ
Expand description

rgba, a width × height picture of RGBA8 pixels, downscaled to size × size, in integers, so the same picture gives the same bytes everywhere (ADR-0061). Each pixel out is the mean of the pixels of its square in, from x * width / size up to (x + 1) * width / size (and the same down), in premultiplied alpha, so a transparent pixel adds nothing to the colour beside it; each mean is rounded half up.