pub unsafe fn vexImagePngRead(
ibuf: *const u8,
oBuf: *mut v5_image,
maxw: u32,
maxh: u32,
ibuflen: u32,
) -> u32
Expand description
Decodes a PNG file passed to ibuf
into a buffer of pixels that can be drawn to the display. This function uses
libpng
internally to decode the file’s contents.
§Arguments
ibuf
: The PNG file as a buffer of bytes.obuf
: A decoded image encoded as RGB8 pixels that will be written to if the operation succeeds.maxw
: Width capacity of the image buffer.maxh
: Height capacity of the image buffer.ibuflen
: Length of the input buffer.
§Return
1
if the operation is successful, 0
if it failed.
§Safety
ibuf
must be null, OR point to a buffer of at least length ibuflen.oBuf
must point to an initializedv5_image
struct or null.(*oBuf).data
must point to a mutable allocated image buffer that is at leastmaxw * maxh * 4
bytes long or be null.
§Safety
Calls to jumptable functions are unsafe because jumptable functions are owned by VEXos and we cannot guarantee their safety.