Ken Van Hoeylandt 7ea8c346b0
Various improvements (#673)
Graphics & rendering

- Implement `binfont-module` to generate bitmap fonts on the device itself
- Remove lodepng support from LVGL library and create `Modules/lodepng-module` to make the feature re-usable in non-LVGL apps too. Add binding functions for LVGL support.
- Implement large icons for boot screen (Tactility and USB logos)
- Remove unused asset files in `Data/`

Boot

- Split up `Tactility.cpp` and its `run()` function into various `Init*.cpp` files.
- Re-implement `Boot.cpp` app as non-LVGL app
- Boot app now has a `BootSequence.cpp` for the init code.
- LVGL is now started when the Boot app finishes
- Move more init logic into Boot app

BLE

- Don't allocate scan result buffers unless BLE is on
- Allocate scan results in external memory if possible

UX & UI

- USB Settings app: remove border from the button container
2026-10-04 18:09:21 +02:00

33 lines
957 B
C

#include "save_png.h"
#include <lodepng/lodepng.h>
#include <lvgl.h>
bool lv_screenshot_save_png_file(const uint8_t* image, uint32_t w, uint32_t h, uint32_t bpp, const char* filename) {
unsigned char* png = NULL;
size_t png_size = 0;
unsigned error;
if (bpp == 32) {
error = lodepng_encode32(&png, &png_size, image, w, h);
} else if (bpp == 24) {
error = lodepng_encode24(&png, &png_size, image, w, h);
} else {
return false;
}
if (error) {
lodepng_free(png);
return false;
}
// Written through lv_fs, so LVGL drive letter paths ("A:...") work
bool success = false;
lv_fs_file_t file;
if (lv_fs_open(&file, filename, LV_FS_MODE_WR) == LV_FS_RES_OK) {
uint32_t written = 0;
success = lv_fs_write(&file, png, png_size, &written) == LV_FS_RES_OK && written == png_size;
lv_fs_close(&file);
}
lodepng_free(png);
return success;
}