pub fn encode_png_rgba(
width: u32,
height: u32,
rgba: &[u8],
) -> Result<Vec<u8>, String>Expand description
Encodes a tight RGBA8 buffer as PNG.
§Errors
Returns an error when rgba.len() is not exactly width * height * 4 or
when the image encoder rejects the output.
§Examples
use ailloli_ui_render_wgpu::capture::encode_png_rgba;
let png = encode_png_rgba(1, 1, &[255, 0, 0, 255])?;
assert_eq!(&png[..8], b"\x89PNG\r\n\x1a\n");