I’m trying to add a gradient icon passenger_alarm.png on a total transparent background.
After that flush the widgets data in flush_cb.
However, it seem to be abnormal when I’ve got these widgets data. All the value of Alpha are 0xFF.
rgba_data_flush_from_lvgl.txt (80.4 KB)
I made it like this:
-
Make a transparent background:
lv_obj_set_style_bg_opa(lv_scr_act(), LV_OPA_TRANSP, LV_PART_MAIN);
lv_disp_set_bg_opa(NULL, LV_OPA_TRANSP);lv_obj_t* top_vision = lv_img_create(lv_scr_act());
lv_obj_set_pos(top_vision, 0, 0);
lv_obj_set_size(top_vision, 294, 70); -
Add a image on background:
lv_obj_t* disp_left = lv_img_create(top_vision);
lv_img_set_src(disp_left, “…/resources/passenger_alarm.png”);
lv_obj_set_pos(disp_left, 0, 0);
lv_obj_set_size(disp_left, 294, 70);
lv_obj_set_style_bg_color(disp_left, lv_color_make(255, 0, 0), 0);
lv_obj_set_style_bg_opa(disp_left, LV_OPA_TRANSP, LV_PART_ANY); -
Found out that the Alpha of gradient is always 0xFF. I’ve tried to save down it as png, via opencv’s cv::imwrite for example, it likes this:
The Gradient was lost!
How can I do to make this gradient normal?
I’ve also uploaded the main.c of my sample.
main.c (5.3 KB)
Thx!