Lightweight drawing of primitive objects

I would like to draw some simple graphics in my application; lines, arcs/circles, polygons; nothing fancy. However to do this I apparently need to create a large true color canvas buffer; my particular ESP32 device doesn’t have the memory to handle this.

As it is I am just reverting to use the underlying TFT drivers which is working fine (tft.fillCircle, tft.drawLine etc.) but isn’t the LVGL way.

Is there a way to get the current screen buffer and use it as my canvas?

You can do it without using lv_canvas. You can create a simple lv_obj and add an LV_EVENT_DRAW_MAIN event. In it you can use any lv_draw_* function to draw anything on the fly.

All these will be managed by LVGL so unlike with tft.fillCircle if you move the widget the draw event will be fired automatically and the widget can redraw itself.

For example this how lv_arc draws itself: https://github.com/lvgl/lvgl/blob/master/src/widgets/arc/lv_arc.c#L631

You can do something similar but custom.