reenable lv_img
This commit is contained in:
@@ -96,8 +96,9 @@ lv_obj_t * lv_img_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
|
||||
if(copy == NULL) {
|
||||
lv_theme_apply(img, LV_THEME_IMAGE);
|
||||
lv_obj_set_click(img, false);
|
||||
lv_obj_set_adv_hittest(img, true); /*Images have fast hit-testing*/
|
||||
lv_obj_clear_flag(img, LV_OBJ_FLAG_CLICKABLE);
|
||||
lv_obj_add_flag(img, LV_OBJ_FLAG_ADV_HITTEST);
|
||||
|
||||
/* Enable auto size for non screens
|
||||
* because image screens are wallpapers
|
||||
* and must be screen sized*/
|
||||
@@ -121,7 +122,7 @@ lv_obj_t * lv_img_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_img_set_src(img, copy_ext->src);
|
||||
|
||||
/*Refresh the style with new signal function*/
|
||||
lv_obj_refresh_style(img, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL);
|
||||
_lv_obj_refresh_style(img, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL);
|
||||
}
|
||||
|
||||
LV_LOG_INFO("image created");
|
||||
@@ -229,7 +230,7 @@ void lv_img_set_src(lv_obj_t * img, const void * src_img)
|
||||
}
|
||||
|
||||
/*Provide enough room for the rotated corners*/
|
||||
if(ext->angle || ext->zoom != LV_IMG_ZOOM_NONE) lv_obj_refresh_ext_draw_pad(img);
|
||||
if(ext->angle || ext->zoom != LV_IMG_ZOOM_NONE) _lv_obj_refresh_ext_draw_pad(img);
|
||||
|
||||
lv_obj_invalidate(img);
|
||||
}
|
||||
@@ -289,13 +290,13 @@ void lv_img_set_offset_y(lv_obj_t * img, lv_coord_t y)
|
||||
* Set the rotation center of the image.
|
||||
* The image will be rotated around this point
|
||||
* @param img pointer to an image object
|
||||
* @param pivot_x rotation center x of the image
|
||||
* @param pivot_y rotation center y of the image
|
||||
* @param x rotation center x of the image
|
||||
* @param y rotation center y of the image
|
||||
*/
|
||||
void lv_img_set_pivot(lv_obj_t * img, lv_coord_t pivot_x, lv_coord_t pivot_y)
|
||||
void lv_img_set_pivot(lv_obj_t * img, lv_coord_t x, lv_coord_t y)
|
||||
{
|
||||
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
|
||||
if(ext->pivot.x == pivot_x && ext->pivot.y == pivot_y) return;
|
||||
if(ext->pivot.x == x && ext->pivot.y == y) return;
|
||||
|
||||
lv_style_int_t transf_zoom = lv_obj_get_style_transform_zoom(img, LV_IMG_PART_MAIN);
|
||||
transf_zoom = (transf_zoom * ext->zoom) >> 8;
|
||||
@@ -313,9 +314,9 @@ void lv_img_set_pivot(lv_obj_t * img, lv_coord_t pivot_x, lv_coord_t pivot_y)
|
||||
a.y2 += img->coords.y1;
|
||||
lv_obj_invalidate_area(img, &a);
|
||||
|
||||
ext->pivot.x = pivot_x;
|
||||
ext->pivot.y = pivot_y;
|
||||
lv_obj_refresh_ext_draw_pad(img);
|
||||
ext->pivot.x = x;
|
||||
ext->pivot.y = y;
|
||||
_lv_obj_refresh_ext_draw_pad(img);
|
||||
|
||||
_lv_img_buf_get_transformed_area(&a, w, h, transf_angle, transf_zoom, &ext->pivot);
|
||||
a.x1 += img->coords.x1;
|
||||
@@ -354,7 +355,7 @@ void lv_img_set_angle(lv_obj_t * img, int16_t angle)
|
||||
lv_obj_invalidate_area(img, &a);
|
||||
|
||||
ext->angle = angle;
|
||||
lv_obj_refresh_ext_draw_pad(img);
|
||||
_lv_obj_refresh_ext_draw_pad(img);
|
||||
|
||||
_lv_img_buf_get_transformed_area(&a, w, h, transf_angle + ext->angle, transf_zoom, &ext->pivot);
|
||||
a.x1 += img->coords.x1;
|
||||
@@ -397,7 +398,7 @@ void lv_img_set_zoom(lv_obj_t * img, uint16_t zoom)
|
||||
lv_obj_invalidate_area(img, &a);
|
||||
|
||||
ext->zoom = zoom;
|
||||
lv_obj_refresh_ext_draw_pad(img);
|
||||
_lv_obj_refresh_ext_draw_pad(img);
|
||||
|
||||
_lv_img_buf_get_transformed_area(&a, w, h, transf_angle, (transf_zoom * ext->zoom) >> 8, &ext->pivot);
|
||||
a.x1 += img->coords.x1;
|
||||
@@ -439,23 +440,6 @@ const void * lv_img_get_src(lv_obj_t * img)
|
||||
return ext->src;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the file set for an image
|
||||
* @param img pointer to an image
|
||||
* @return file name
|
||||
*/
|
||||
const char * lv_img_get_file_name(const lv_obj_t * img)
|
||||
{
|
||||
LV_ASSERT_OBJ(img, LV_OBJX_NAME);
|
||||
|
||||
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
|
||||
|
||||
if(ext->src_type == LV_IMG_SRC_FILE)
|
||||
return ext->src;
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the auto size enable attribute
|
||||
* @param img pointer to an image
|
||||
@@ -621,7 +605,7 @@ static lv_design_res_t lv_img_design(lv_obj_t * img, const lv_area_t * clip_area
|
||||
|
||||
/*If the border is drawn later disable loading its properties*/
|
||||
if(lv_obj_get_style_border_post(img, LV_OBJ_PART_MAIN)) {
|
||||
bg_dsc.border_opa = LV_OPA_TRANSP;
|
||||
bg_dsc.border_post = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -779,22 +763,21 @@ static lv_design_res_t lv_img_design(lv_obj_t * img, const lv_area_t * clip_area
|
||||
static lv_res_t lv_img_signal(lv_obj_t * img, lv_signal_t sign, void * param)
|
||||
{
|
||||
lv_res_t res;
|
||||
if(sign == LV_SIGNAL_GET_STYLE) {
|
||||
|
||||
lv_get_style_info_t * info = param;
|
||||
info->result = lv_img_get_style(img, info->part);
|
||||
if(info->result != NULL) return LV_RES_OK;
|
||||
else return ancestor_signal(img, sign, param);
|
||||
}
|
||||
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_signal(img, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
|
||||
|
||||
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
|
||||
if(sign == LV_SIGNAL_CLEANUP) {
|
||||
|
||||
if(sign == LV_SIGNAL_GET_STYLE) {
|
||||
lv_get_style_info_t * info = param;
|
||||
info->result = lv_img_get_style(img, info->part);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
return _lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CLEANUP) {
|
||||
if(ext->src_type == LV_IMG_SRC_FILE || ext->src_type == LV_IMG_SRC_SYMBOL) {
|
||||
lv_mem_free(ext->src);
|
||||
ext->src = NULL;
|
||||
@@ -838,8 +821,6 @@ static lv_res_t lv_img_signal(lv_obj_t * img, lv_signal_t sign, void * param)
|
||||
img->ext_draw_pad = LV_MATH_MAX(img->ext_draw_pad, right);
|
||||
img->ext_draw_pad = LV_MATH_MAX(img->ext_draw_pad, top);
|
||||
img->ext_draw_pad = LV_MATH_MAX(img->ext_draw_pad, bottom);
|
||||
|
||||
|
||||
}
|
||||
else if(sign == LV_SIGNAL_HIT_TEST) {
|
||||
lv_hit_test_info_t * info = param;
|
||||
@@ -866,7 +847,7 @@ static lv_res_t lv_img_signal(lv_obj_t * img, lv_signal_t sign, void * param)
|
||||
info->result = _lv_area_is_point_on(&coords, info->point, 0);
|
||||
}
|
||||
else
|
||||
info->result = lv_obj_is_point_on_coords(img, info->point);
|
||||
info->result = _lv_obj_is_click_point_on(img, info->point);
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
@@ -103,10 +103,10 @@ void lv_img_set_offset_y(lv_obj_t * img, lv_coord_t y);
|
||||
* Set the rotation center of the image.
|
||||
* The image will be rotated around this point
|
||||
* @param img pointer to an image object
|
||||
* @param pivot_x rotation center x of the image
|
||||
* @param pivot_y rotation center y of the image
|
||||
* @param x rotation center x of the image
|
||||
* @param y rotation center y of the image
|
||||
*/
|
||||
void lv_img_set_pivot(lv_obj_t * img, lv_coord_t pivot_x, lv_coord_t pivot_y);
|
||||
void lv_img_set_pivot(lv_obj_t * img, lv_coord_t x, lv_coord_t y);
|
||||
|
||||
/**
|
||||
* Set the rotation angle of the image.
|
||||
@@ -146,13 +146,6 @@ void lv_img_set_antialias(lv_obj_t * img, bool antialias);
|
||||
*/
|
||||
const void * lv_img_get_src(lv_obj_t * img);
|
||||
|
||||
/**
|
||||
* Get the name of the file set for an image
|
||||
* @param img pointer to an image
|
||||
* @return file name
|
||||
*/
|
||||
const char * lv_img_get_file_name(const lv_obj_t * img);
|
||||
|
||||
/**
|
||||
* Get the auto size enable attribute
|
||||
* @param img pointer to an image
|
||||
|
||||
Reference in New Issue
Block a user