How do I set the image source to mask out an arc on a complex/gradient image?


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

PC Simulator

What LVGL version are you using?

LVGL release/v8.2
pc_simulator_sdl_eclipse release/v8.2

What do you want to achieve?

Mask out an arc on a complex/gradient image. Such as the image below.

What have you tried so far?

I have tried to set the arc image source using lv_style_set_arc_img_src(lv_style_t * style, const void * value), but the image was not visible. So I tried using a small test image with no transparent pixels and it seems to be redrawing the image centered on the knobs position.

Code to reproduce

    static lv_style_t style;
    lv_style_set_arc_rounded(&style, 0);
    lv_style_set_arc_width(&style, 40);
    lv_style_set_arc_img_src(&style, &img_test);
    speed_arc = lv_arc_create(lv_scr_act());

//    lv_obj_add_style(speed_arc, &style, LV_PART_MAIN);
    lv_obj_add_style(speed_arc, &style, LV_PART_INDICATOR);
    lv_obj_remove_style(speed_arc, NULL, LV_PART_KNOB);
    lv_obj_set_size(speed_arc, 380, 380);
    lv_arc_set_rotation(speed_arc, 150);
    lv_arc_set_bg_angles(speed_arc, 0, 240);
    lv_arc_set_range(speed_arc, 0, 240);
    lv_arc_set_value(speed_arc, 120);

There was a related bug v8.2. Please try with the current master.

Thanks kisvegabor, the master branch is working for me.