pub const fn buffer_length(width: usize, height: usize) -> usizeExpand description
Calculate the length of a BMP file of the given width and height.
The BMP format has a header and stores each row padded to 4 byte alignment, so the final length will be larger than a simple (WIDTH * HEIGHT * 3) or (WIDTH * HEIGHT * 3 + BMP_HEADER_LENGTH) calculation.
This will be the minimum required size of the buffer passed to write_bmp. Is a const function so it can be used as the size of a statically sized array.
let mut buffer = [0u8; simple_bmp::buffer_length(100, 100)];