|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
Decode PNG/JPEG bytes into a dithered 1-bpp raster (no capability). More...
Functions | |
| int | host_image_info (const uint8_t *data, size_t len, uint16_t *out_w, uint16_t *out_h) |
| Decode only the image header to get its dimensions. | |
| int | host_image_render (const uint8_t *data, size_t len, uint16_t target_w, uint8_t *out, size_t out_size, uint16_t *out_stride_bytes, uint16_t *out_height_px) |
| Decode, scale to target_w (aspect preserved) and dither to 1-bpp. | |
Decode PNG/JPEG bytes into a dithered 1-bpp raster (no capability).
Pure compute on caller memory. Output layout matches the QR and surface APIs: packed rows, MSB-first, a set bit is black. Decoding uses the same engine as the firmware image viewer (max ~1 megapixel input).
| int host_image_info | ( | const uint8_t * | data, |
| size_t | len, | ||
| uint16_t * | out_w, | ||
| uint16_t * | out_h ) |
Decode only the image header to get its dimensions.
| data | Encoded PNG or JPEG bytes. |
| len | Byte length. |
| out_w | Receives the native width in pixels. |
| out_h | Receives the native height in pixels. |
Definition at line 42 of file host_api_image.cpp.
References HOST_ERR_GENERIC, HOST_ERR_INVALID_ARG, HOST_OK, LOG_W, and TAG.
Referenced by cdc::plugin_manager::w_host_image_info().
| int host_image_render | ( | const uint8_t * | data, |
| size_t | len, | ||
| uint16_t | target_w, | ||
| uint8_t * | out, | ||
| size_t | out_size, | ||
| uint16_t * | out_stride_bytes, | ||
| uint16_t * | out_height_px ) |
Decode, scale to target_w (aspect preserved) and dither to 1-bpp.
| data | Encoded PNG or JPEG bytes. |
| len | Byte length. |
| target_w | Output width in pixels, 1..1024 (e.g. 384 for thermal print). |
| out | Caller buffer for packed rows. |
| out_size | Capacity of out in bytes. |
| out_stride_bytes | Receives the row stride (target_w + 7) / 8. |
| out_height_px | Receives the scaled height. |
Definition at line 56 of file host_api_image.cpp.
References HOST_ERR_GENERIC, HOST_ERR_INVALID_ARG, HOST_ERR_NO_MEMORY, HOST_OK, LOG_W, cdc::core::psramAlloc(), and TAG.
Referenced by host_sprite_create_from_image(), and cdc::plugin_manager::w_host_image_render().