Problem of drawing line behavior

Description

Hi everyone, the problem might be a little bit weird.
I’m using 32bits color depth.
When I draw lines, if I set the color opacity to zero (e.g. 0x000000FF),
I expect it would draw nothing although I fill the value of B channel.

However, it still draws blue color borders like a hollow line (as the figure shows).
I wonder if there is a way to draw nothing while zero opacity is set.

    static lv_point_t line_points[2];

    line_points[0] = (lv_point_t){100,30};
    line_points[1] = (lv_point_t){300,100};  
    static lv_style_t style_line;
    lv_color_t color;
    color.full = 0x000000FFU;

    lv_obj_t * line1;
    line1 = lv_line_create(buf_screen[VoutID], NULL);
    lv_line_set_points(line1, &line_points[0], 2); 
    lv_obj_set_pos(line1,0,0);  
    lv_obj_set_style_local_line_color(line1,LV_LINE_PART_MAIN,LV_STATE_DEFAULT,color);
    lv_obj_set_style_local_line_width(line1,LV_LINE_PART_MAIN,LV_STATE_DEFAULT,10);

Screenshot and/or video

You may have found an edge case in the antialiasing logic; I’m not sure if it considers the original line’s opacity. @kisvegabor

The problem is LVGL NOT uses the opacity from the color. It’s because other color formats (e.g. RGB565) have no alpha channel. You should use lv_color_hex() or similar function to create a color and the line_opa style property to make it transparent.


  lv_color_t color = lv_color_hex(0x0000ff);

  lv_obj_t * line1;
  line1 = lv_line_create(lv_scr_act(), NULL);
  lv_line_set_points(line1, &line_points[0], 2);
  lv_obj_set_pos(line1,0,0);
  lv_obj_set_style_local_line_color(line1,LV_LINE_PART_MAIN,LV_STATE_DEFAULT,color);
  lv_obj_set_style_local_line_width(line1,LV_LINE_PART_MAIN,LV_STATE_DEFAULT,10);
  lv_obj_set_style_local_line_opa(line1,LV_LINE_PART_MAIN,LV_STATE_DEFAULT, LV_OPA_30);