lvgl: In v9 Parent and child elements of the same size, but the child element cannot completely cover the parent element
Describe the bug
Set the size of the parent element to 200X200, the background to red, the child element to a 100X100 picture, the child element is scaled to 200X200, As a result, the child element does not completely cover the parent element.
void lv_image_test(void){
int ww = 200;
lv_obj_t* native = lv_obj_create(lv_scr_act());
lv_obj_remove_style_all(native);
lv_obj_set_width(native,ww);
lv_obj_set_height(native,ww);
lv_obj_set_pos(native, 100, 50);
lv_image_t* img_ = lv_img_create(native);
lv_obj_remove_style_all(img_);
lv_obj_center(img_);
lv_img_set_src(img_, "00.jpeg");
lv_obj_set_width(img_,ww);
lv_obj_set_height(img_,ww);
lv_obj_set_style_bg_color(img_, lv_palette_main(LV_PALETTE_RED), LV_PART_MAIN);
lv_obj_set_style_bg_opa(img_, LV_OPA_80, LV_PART_MAIN);
uint16_t zoomHeight = ww * LV_SCALE_NONE / img_->h;
img_->zoom = zoomHeight;
lv_img_set_size_mode(img_, LV_IMAGE_SIZE_MODE_REAL);
}
00.jpeg
Expected behavior
The child element completely covers the parent element.
Screenshots or video
About this issue
- Original URL
- State: closed
- Created 7 months ago
- Comments: 15 (7 by maintainers)
Commits related to this issue
- fix(draw): fix off by one scaling issue o nthe left and bottom fixes #4993 — committed to xaowang96/lvgl by kisvegabor 6 months ago
I should be fixed. Finally I added a special handling to image scale only (no rotation).
It means we need to deeply look into the SW image transformation. I’ll try fixing it again.