|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
Encode text into a 1-bpp packed QR raster (no capability required). More...
Functions | |
| int | host_qr_measure (const char *data, uint8_t max_version, uint8_t ecc, uint16_t *out_modules) |
| Measure the QR module count for data without rendering. | |
| int | host_qr_render_bitmap (const char *data, uint8_t max_version, uint8_t ecc, uint8_t scale, uint8_t quiet_modules, uint8_t *out, size_t out_size, uint16_t *out_stride_bytes, uint16_t *out_height_px) |
| Encode data into a packed 1-bpp QR raster. | |
Encode text into a 1-bpp packed QR raster (no capability required).
Pure compute on caller memory. The output layout matches the surface and image APIs: packed rows, MSB-first, a set bit is black. Blit the result onto a surface with host_surface_draw_bitmap or send it to a printer.
| int host_qr_measure | ( | const char * | data, |
| uint8_t | max_version, | ||
| uint8_t | ecc, | ||
| uint16_t * | out_modules ) |
Measure the QR module count for data without rendering.
| data | NUL-terminated payload text. |
| max_version | Maximum QR version 1..20 (0 = 20). |
| ecc | ECC level 0..3 (LOW, MED, QUART, HIGH). |
| out_modules | Receives the side length in modules. |
Definition at line 16 of file host_api_qr.cpp.
References HOST_ERR_GENERIC, HOST_ERR_INVALID_ARG, HOST_OK, and cdc::ui::qr::measure().
Referenced by cdc::plugin_manager::w_host_qr_measure().
| int host_qr_render_bitmap | ( | const char * | data, |
| uint8_t | max_version, | ||
| uint8_t | ecc, | ||
| uint8_t | scale, | ||
| uint8_t | quiet_modules, | ||
| uint8_t * | out, | ||
| size_t | out_size, | ||
| uint16_t * | out_stride_bytes, | ||
| uint16_t * | out_height_px ) |
Encode data into a packed 1-bpp QR raster.
Side length is (modules + 2 * quiet_modules) * scale pixels, capped at
| data | NUL-terminated payload text. |
| max_version | Maximum QR version 1..20 (0 = 20). |
| ecc | ECC level 0..3. |
| scale | Pixels per module (0 counts as 1). |
| quiet_modules | Quiet-zone width in modules per edge. |
| out | Caller buffer for packed rows. |
| out_size | Capacity of out in bytes. |
| out_stride_bytes | Receives the row stride in bytes. |
| out_height_px | Receives the side length in pixels. |
Definition at line 24 of file host_api_qr.cpp.
References HOST_ERR_GENERIC, HOST_ERR_INVALID_ARG, HOST_ERR_NO_MEMORY, HOST_OK, and cdc::ui::qr::render().
Referenced by cdc::plugin_manager::w_host_qr_render_bitmap().