Artificial horizon visualization

Hello,

I am quite new here and I’m amazed at the possibilities of LittlevGL. I am currently working on proroject of artificial horizon for the aircraft. It should seems something like this:

I am wondering if LittlevGL has any feature to achieve this. I found function canvas and want to ask, if it wold be possible for example use it with two polygons (one (blue) for the sky and the second (brown) for the ground) and change the points coordinations in real time to visualize the roll and pitch. Or if would be possible to have fix canvas and just rotete it (even with the lines and text showed on the video).

Thank you for any suggestions how to done this.

It’s probably most performant to use a canvas and draw two polygons on it. You can then create text objects on top of the canvas to display the other information.

Thank you for your feedback. Ideally I would like to also move and tilt the “level lines” with the numbers of angle 10, 20, …, together with the horizon line - not stable as on the video. Do you think it would be possible to create another canvas with transparent background above the first one with the ground and sky and use img rotation to tilt those lines and numbers?

Thank you for your reply.

Do you need the numbers to rotate with the sky and ground, or can they remain fixed on the screen?

If only the sky and ground need to rotate, I would just redraw the two polygons with different points. It will give the same effect and be much cheaper in terms of performance.

lv_draw_polygon no necessarily needs a canvas but still there is no lv_polygon object to draw with it in real-time (similarly to lv_line).

However, even lv_line could be extended: if(style.body.opa != LV_OPA_TRANSP) lv_draw_polygon(...)

Using an object would be much better because a screen-sized canvas needs a lot of memory.

What do you think?

@embeddedt, I have already tried the full-screen and one polygon (I fill the canvas with brown every loop and the draw the blue polygon on the top) and it woks well (tested only on PC simulator - not sure with the performance in case of ESP32 I like to work with in the real project). As I mention, I would like to also tilt the lines and numbers together with the horizon, so I convert a .bmp pisture of the lines and numers via convertor to .c img (2-bit indexed colors) and try to rotate it onto the canvas with lv_canvas_rotate but unfortunately it does not work. As I red (https://github.com/littlevgl/lvgl/issues/684#issuecomment-476890452) , the different color format of the image and the canvas (TRUE_COLOR) should not be a problem, but this is probably the reason why it is no working.

@kisvegabor, so are you going to add a new feature of lv_draw_polygon object? It would be very helpfull.