Hi !
in lvgl/V7:
I use it in the following way, the pixel value of each obj is the same:
uint8_t *old_buf = lv_mem_alloc(LV_IMG_BUF_SIZE_TRUE_COLOR_ALPHA(LV_HOR_RES_MAX, LV_VER_RES_MAX));
static lv_img_dsc_t lv_img_dsc = {0};
memset(&lv_img_dsc, 0, sizeof(lv_img_dsc_t));
lv_img_dsc.header.always_zero = 0;
lv_img_dsc.header.w = lv_obj_get_width(blur_obj);
lv_img_dsc.header.h = lv_obj_get_height(blur_obj);
lv_img_dsc.header.cf = LV_IMG_CF_TRUE_COLOR_ALPHA;
lv_img_dsc.data_size = LV_IMG_BUF_SIZE_TRUE_COLOR_ALPHA(LV_HOR_RES_MAX, LV_VER_RES_MAX);
lv_img_dsc.data = old_buf;
lv_color_t color = lv_obj_get_style_bg_color(blur_obj, LV_OBJ_PART_MAIN);
lv_opa_t opa = lv_obj_get_style_bg_opa(blur_obj, LV_OBJ_PART_MAIN);
lv_obj_set_style_local_pattern_image(blur_obj, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, &lv_img_dsc);
lv_obj_set_style_local_pattern_recolor(blur_obj, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, color);
lv_obj_set_style_local_pattern_recolor_opa(blur_obj, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, opa);
lv_obj_refresh_style(blur_obj, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT);
The specific running results are as follows: You can see that the colors of the three cards are the same.
I use like this, the pixel value of each object is different
uint8_t *old_buf = lv_mem_alloc(LV_IMG_BUF_SIZE_TRUE_COLOR_ALPHA(LV_HOR_RES_MAX, LV_VER_RES_MAX));
lv_img_dsc_t *lv_img_dsc = lv_mem_alloc(LV_IMG_BUF_SIZE_TRUE_COLOR_ALPHA(LV_HOR_RES_MAX, LV_VER_RES_MAX));
lv_img_dsc->header.always_zero = 0;
lv_img_dsc->header.w = lv_obj_get_width(blur_obj);
lv_img_dsc->header.h = lv_obj_get_height(blur_obj);
lv_img_dsc->header.cf = LV_IMG_CF_TRUE_COLOR_ALPHA;
lv_img_dsc->data_size = LV_IMG_BUF_SIZE_TRUE_COLOR_ALPHA(LV_HOR_RES_MAX, LV_VER_RES_MAX);
lv_img_dsc->data = old_buf;
lv_color_t color = lv_obj_get_style_bg_color(blur_obj, LV_OBJ_PART_MAIN);
lv_opa_t opa = lv_obj_get_style_bg_opa(blur_obj, LV_OBJ_PART_MAIN);
lv_obj_set_style_local_pattern_image(blur_obj, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, lv_img_dsc);
lv_obj_set_style_local_pattern_recolor(blur_obj, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, color);
lv_obj_set_style_local_pattern_recolor_opa(blur_obj, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, opa);
lv_obj_refresh_style(blur_obj, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT);
The specific results are as follows: You can see that the colors of the three cards are different.
I think the design here is not good enough, because I have changed the memory address pointed to by lv_img_dsc->data, which means that the data I want to refresh has changed, but the actual performance has not changed.
I need to change the memory addresses of both lv_img_dsc and old_buf to get the result I want.
Also, I would like to know what is the replacement function for the lv_obj_set_style_local_pattern_xxxx series in the V8 version, thanks