vex_sdk::display

Function vexImageBmpRead

Source
pub unsafe fn vexImageBmpRead(
    ibuf: *const u8,
    oBuf: *mut v5_image,
    maxw: u32,
    maxh: u32,
) -> u32
Expand description

Decodes a bitmap-encoded image passed to ibuf into a buffer of pixels that can be drawn to the display.

§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.

§Return

1 if the operation is successful, 0 if it failed.

§Safety

  • oBuf must point to an initialized v5_image struct or null.
  • (*oBuf).data must point to a mutable allocated image buffer that is at least maxw * 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.