Lv_draw_sw_rgb565_swap

hey, this was tricky for me too, but i solved like this:

void Renderer::flushCb(
    lv_display_t *display, const lv_area_t *area, uint8_t *px_map)
{
    lv_draw_sw_rgb565_swap(
        px_map, (area->x2 - area->x1 + 1) * (area->y2 - area->y1 + 1));

    const int offsetx1 = area->x1;
    const int offsetx2 = area->x2;
    const int offsety1 = area->y1;
    const int offsety2 = area->y2;
    esp_lcd_panel_draw_bitmap(
        panel_handle, offsetx1, offsety1, offsetx2 + 1, offsety2 + 1, px_map);

    lv_disp_flush_ready(display);
}

you have to swap the colors before sending the command to draw the bitmap.

1 Like