How to draw dynamic on screen

Description

i want to draw a line dynamic by touchpad.would you give some guidance?

What MCU/Processor/Board and compiler are you using?

What LVGL version are you using?

What do you want to achieve?

What have you tried so far?

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

/*You code here*/

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

You can get some hint from lv_line.
https://docs.lvgl.io/latest/en/html/widgets/line.html#example
Perhaps you can save your points to your buffer and draw them every ticks as you want.

i want to signature on touchpad.when signature done,i can gain the signatrue value.would you give some guidance

here is my sample code
void Signature()
{
lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
lv_point_t p[1024];
u32 cnt=0;
lv_obj_t * area;
uint32_t t;
TRACE(DBG_TRACE_LVL, ā€œ%s\r\nā€,FUNCTION);
disp_backlight();
area = lv_line_create(lv_scr_act(), NULL);
/Create style/
static lv_style_t style_line;
lv_style_init(&style_line);
lv_style_set_line_width(&style_line, LV_STATE_DEFAULT, 8);
lv_style_set_line_color(&style_line, LV_STATE_DEFAULT, LV_COLOR_BLUE);
lv_style_set_line_rounded(&style_line, LV_STATE_DEFAULT, true);
while(tp_press)
{
lv_line_set_points(area, p, cnt);
lv_obj_add_style(area, LV_LINE_PART_MAIN, &style_line);
lv_refr_now(NULL);
t = lv_tick_get();
while(lv_tick_elaps(t) < 1000);
p[cnt].x=position_x;
p[cnt].y=position_y;
cnt++;

}

}