I find myself facing the same problem I had a couple of years ago (How to change single pixels in a monochrome Canvas). I found a solution for that but it doesn’t seem to work in version 6 of the library (which I need to use for reasons that are not relevant).
What MCU/Processor/Board and compiler are you using?
For now I’m working on the SDL simulator.
What LVGL version are you using?
What do you want to achieve?
Changing single pixels on a canvas.
What have you tried so far?
The solution proposed here: How to change single pixels in a monochrome Canvas.
It works in version 7 but not in version 6.
Code to reproduce
The following code with
LV_COLOR_DEPTH set as 1. The display is 128x64 pixels.
static lv_color_t buffer[LV_CANVAS_BUF_SIZE_INDEXED_1BIT(48, 48)]; lv_obj_t * canvas = lv_canvas_create(lv_scr_act(), NULL); lv_canvas_set_buffer(canvas, buffer, 48, 48, LV_IMG_CF_INDEXED_1BIT); lv_color_t black; black.full = 0; lv_color_t white; white.full = 1; lv_canvas_set_palette(canvas, 0, LV_COLOR_WHITE); lv_canvas_set_palette(canvas, 1, LV_COLOR_BLACK); lv_canvas_set_px(canvas, 1, 1, black); lv_canvas_set_px(canvas, 2, 2, white); lv_obj_align(canvas, NULL, LV_ALIGN_CENTER, 0, 0)