pub fn astc_decode_block<F: FnMut(u32, u32, [u8; 4])>(
input: &[u8; 16],
footprint: Footprint,
writer: F,
) -> boolExpand description
Decode an ASTC block from a 16-byte buffer.
inputcontains the raw ASTC data for one block.footprintspecifies the footprint size.writeris a function with signatureFnMut(x: u32, y: u32, color: [u8; 4]). It is used to output decoded pixels. This function will be called once for each pixel(x, y)in the rectangle[0, footprint.width()) * [0, footprint.height()). Each element incolorrepresents the R, G, B, and A channel, respectively.- returns
trueif the block is successfully decoded;falseif the block contains illegal encoding.
let footprint = astc_decode::Footprint::new(6, 6);
// Exmaple input. Not necessarily a valid ASTC block
let input = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
let mut output = [[0; 4]; 6 * 6];
astc_decode::astc_decode_block(&input, footprint, |x, y, color| {
output[(x + y * 6) as usize] = color;
});