Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Row.createImageCell creates scaled image even all paddings are removed. #268

Open
TomasMatusek opened this issue Jun 30, 2023 · 1 comment
Assignees
Labels
Milestone

Comments

@TomasMatusek
Copy link

TomasMatusek commented Jun 30, 2023

Hi.

When I am trying to create a ImageCell and I set all padding to 0 it is ignored and padding is left there.

Here is my code:

be.quodlibet.boxable.image.Image icon = ImageUtils.readImage(getBackupStatusIcon("green"));
cell = row.createImageCell(iconWidth, icon, HorizontalAlignment.CENTER, VerticalAlignment.MIDDLE);
cell.removeAllPadding(); // this is ignored, image is scaled before you can change padding values

Result is:
image

I left borders there so it is clear that around each dot - representing status icon there is a padding from left and right even I set it to 0 by using removeAllPadding() method. You can see that icons are super small even they should occupy all space between black borders around.

From investigation I found that image is scaled down immediately after instantiation of ImageCell object:
image

You can see that getInnerWidth() is calculated using default paddings = 5f and image is scaled down. Before you can even set the padding to be = 0; so the result is:

  1. Instance is created and image size is calculated using default paddings = 5f
  2. Image is scaled down based on step 1)
  3. Then you are allowed to set padding to the new values
  4. These values are ignored as instance was already created and image size down scaled.

When I tried to debug the issue and set those default padding values manually in debugger during the run the result was what I would expect:

image
@johnmanko johnmanko added the bug label Nov 3, 2023
@johnmanko johnmanko self-assigned this Nov 3, 2023
@johnmanko johnmanko added this to the 1.7.1 milestone Nov 3, 2023
@johnmanko
Copy link
Collaborator

I'll look into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants