Skip to content

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

@TomasMatusek

Description

@TomasMatusek

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

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions