How to draw a new line which cover the old one?


How to draw a new line which cover the old one?

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


What LVGL version are you using?


What do you want to achieve?

Using the funciton of lv_draw_line() to draw a new line to cover the old one

What have you tried so far?

using the methods of lv_obj_invalidate_area(obj, &redraw_area);

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:

//support I have many points
//between two points there exists a line
//I want to draw a line which replace the old one
for (int i = 0; i < count; ++i)
    /* code */
    lv_obj_invalidate_area(obj, &redraw_area);
	//the redrwa_area is the p1 and p2's coordinate

    if(ser->points[p_prev] != LV_WAVE_POINT_NONE && ser->points[p_act] != LV_WAVE_POINT_NONE) {
        lv_draw_line(&p1, &p2, &series_mask, &line_dsc_default);

    hidden_line_dsc_default.color = lv_color_hex(0xffffff);
    hidden_line_dsc_default.width = 8;
    hidden_line_dsc_default.opa = LV_OPA_COVER;
    if(ser->points[p_prev] != LV_WAVE_POINT_NONE && ser->points[p_act] != LV_WAVE_POINT_NONE) {
        lv_draw_line(&p2, &p3, &series_mask, &hidden_line_dsc_default);

    //update the value of p2 and p3
    //which like p1=p2
    //calc p3

Screenshot and/or video

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