Hi,
Is it possible to draw a rectangle (or arc or triangle) on the screen with the lv_draw_rectangle library? I;ve tried using a style and area but nothing is drawn on the screen…
Greetings,
Gesture
Hi,
Is it possible to draw a rectangle (or arc or triangle) on the screen with the lv_draw_rectangle library? I;ve tried using a style and area but nothing is drawn on the screen…
Greetings,
Gesture
rectangle
Use a plain object and change it’s style.
arc
Use the lv_arc
object.
If you need something what really draws (not objects just a drawing) you can use the new features of the canvas object in v6.0:
https://littlevgl.com/sphinx/object-types/canvas.html
@embeddedt: Could you explain that with an example, as I already tried it using a style. What do you mean by a plain object?
I mean the base lv_obj
.
static lv_style_t obj_style;
lv_obj_t * obj;
lv_style_copy(&obj_style, &lv_style_plain_color);
obj_style.body.main_color = obj_style.body.grad_color = LV_COLOR_RED; /* red color */
obj_style.body.radius = 0; /* no radius */
obj = lv_obj_create(lv_scr_act(), NULL);
lv_obj_set_style(obj, &obj_style);
lv_obj_align(obj, NULL, LV_ALIGN_CENTER, 0, 0);
Where is lv_style_plain_color? I do wish fully working examples were added here.
Please take a look at the current documentation. This is an almost 3-year-old post targeting LVGL 6, which is no longer supported.