I was already thinking about an lv_canvas feature to take a snapshot of an area.
E.g. lv_canvas_snapshot(canvas, x_ofs, y_ofs) would take a cavas-sized screenshot from x_ofs and y_ofs coordinates.
I assume it would take a screenshot of the display the canvas is attached to? Could it be separated from the canvas object, and just store the result in an intermediate image buffer which someone could then use as they wished?
Why would it be required? If the problem is that the canvas will be visible on the snapshot than you can make the canvas hidden. (it can happen automatically too).
I think that taking a screenshot should be separated from displaying that screenshot. A use might just wants to take a screenshot and use its raw data.
The canvas object doesn’t feel like the right place to put a snapshot API. I feel like it belongs in its own module or within lv_disp (e.g lv_disp_snapshot(disp, img_buf, x_off, y_off).
That sounds reasonable! disp would be really a better place.
To avoid the use of a big buffer, we could use the disp_buf to tell parts of the image. E.g.: