Problem with lv_img_set_offset_y in ver 7

Description

Hi
In ver 6, I had no problem with lv_img_set_offset_y, but in ver 7, it seems that something has changed about it.
consider this picture as the source of the img object.
offset
Each part has a size of 100 * 50.
In ver 6, if I wanted to display part 7, I had to write sth like this:

lv_img_set_offset_x(img_power_status, 100);
lv_img_set_offset_y(img_power_status, 100);

But now this doesn’t work and instead shows part 6. and seems if I want to show it correctly I should write it like this:

lv_img_set_offset_x(img_power_status, 100);
lv_img_set_offset_y(img_power_status, -100);

Is it a bug or something else?

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

stm32f429igt6, cubeide, gcc

What LVGL version are you using?

v7.5.0

Hi,

Thanks for reporting this. I’ve just pushed a fix to master. Is it working as expected now?

1 Like

Unfortunately, It seems not.

For this code:

  lv_obj_t * img = lv_img_create(lv_scr_act(), NULL);
  LV_IMG_DECLARE(a);
  lv_img_set_src(img, &a);
  lv_obj_set_size(img, 170, 50);
  lv_img_set_offset_x(img, 170);
  lv_img_set_offset_y(img, 106);

I get this:
image

Note that the cells have 170x63 size and not 100x50. At least on the image, you attached in the first post.

1 Like

Yeah, I know. It’s not the exact image in my project. I just made it to ask this question.
Sorry for my mistake. I didn’t test it before. displaying 7 seems O.K. would you please test this:
lv_img_set_offset_y(img, 50);
I expect to show me number 6 but I see number 8.

Sorry for the late reply. I’ve tested with the latest version again and it seemed good to me, but it’s really a little bit counterintuitive due to the tiling.

So, offset means “start the image at this coordinate instead of 0;0 and tile the gaps”. Therefore if you want to go to a number in the table it’s better to think in negative offset as you want to “pull” the image to the left/top.

If it’s still not working please open an issue on GitHub. Sometimes it takes me a long time to catch up with topics in the Forum. :frowning:

1 Like