Skip to content

Conversation

@HeikoKlare
Copy link
Contributor

@HeikoKlare HeikoKlare commented Mar 24, 2025

Each OS-specific implementation of the Image class has its own implementation of an algorithm to calculate a disabled representation of a given image. In addition, the algorithm used on Windows and MacOS produces bad results, which is why usually pre-generated disabled icons are used.

This change centralizes the implementations of those algorithms in ImageColorTransformers. The implementations used for the pre-generated disabled icons is added as default algorithm with an enhanced and the existing GTK-conforming algorithms being provided as options. It is supposed to render the usage of pre-generated disabled version of icons obsolete in many cases.

This is based on the snippet for testing different algorithms proposed by @killingerm and the according discussion in #1741

How to test

Most icons Eclipse are provided in a pre-generated, disabled version. To completely disable this and enforce all icons to be generated on-the-fly via the disablement algorithm, you can change the value of IWorkbenchRegistryConstants#ATT_DISABLEDICON so that the according attribute defining the disabled icon path does not match.

The following screenshot shows how the three version of icons look like:

  • Top: pre-generated icons and icons generated by proposed on-the-fly algorithm
  • Middle: icons with the proposed enhanced on-the-fly algorithm
  • Bottom: icons with the current on-the-fly algorithm (to be removed)

image

@github-actions
Copy link
Contributor

github-actions bot commented Mar 24, 2025

Test Results

   545 files  ±0     545 suites  ±0   31m 34s ⏱️ + 4m 21s
 4 373 tests ±0   4 361 ✅ ±0   12 💤 ±0  0 ❌ ±0 
16 634 runs  ±0  16 520 ✅ ±0  114 💤 ±0  0 ❌ ±0 

Results for commit 677dd56. ± Comparison against base commit 7cc858e.

♻️ This comment has been updated with latest results.

Copy link
Member

@HannesWell HannesWell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR, I really like the result of the proposed on-the-fly algorithm, i.e. the second version in your screenshots.

Below I have written some thoughts about the code.

@HeikoKlare HeikoKlare force-pushed the disabled-extraction-cleanup branch 2 times, most recently from 8394e09 to b4e063b Compare March 27, 2025 18:45
@HeikoKlare HeikoKlare force-pushed the disabled-extraction-cleanup branch 2 times, most recently from b89f20a to 8045613 Compare March 27, 2025 19:09
@HeikoKlare HeikoKlare marked this pull request as ready for review March 27, 2025 19:21
Copy link
Member

@HannesWell HannesWell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As already written I really like the enhanced on-the-fly algorithm, i.e. the second version in your screenshots.
If I understand this PR correctly this is only applied for Windows and Mac. Wouldn't it make sense to use it on Linux as well for consistency?

Besides that this looks good generally. Thanks to everyone involved.

@HeikoKlare HeikoKlare force-pushed the disabled-extraction-cleanup branch from 8045613 to eff45c7 Compare March 28, 2025 09:30
@HeikoKlare
Copy link
Contributor Author

HeikoKlare commented Mar 30, 2025

If I understand this PR correctly this is only applied for Windows and Mac. Wouldn't it make sense to use it on Linux as well for consistency?

We can of course do it for Linux as well. I didn't do this as Linux uses an adapted algorithm (fitting with what GTK does) anyway. But for the sake of being/becoming consistent again, we could unify the algorithm across all OSes, as we keep the previous algorithms in a legacy mode anyway. I have adapted the PR accordingly.

@HeikoKlare
Copy link
Contributor Author

@HannesWell Can you please have another look at this?
I have now adapted the PR as we discussed: By default an image disablement algorithm will be used that conforms with the algorithm used for the existing pre-generated disabled icons. This will allow us to simply remove all the disabled icons and use the on-the-fly algorithm instead. Via a system property, the enhanced mode with the new proposed disabled icon styling can be activated and with gtk a mode conforming to the GTK-like disablement implemented for Linux will be used. These will make most sense when no using pre-generated disabled icons at all (i.e., if we introduced a mode in Platform UI that avoids the usage of explicit disabled icons), as otherwise there will be a mixture of differently styled disabled icons in the UI.

Copy link
Member

@HannesWell HannesWell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update. All what you have described makes sense to me and I'm generally fine with this change and look forward to it. I didn't exactly follow the algorithm changes in all three Image implementations, but I trust your change.

I just have a remark regarding the naming of the values.

@HeikoKlare HeikoKlare force-pushed the disabled-extraction-cleanup branch 2 times, most recently from b2ebdc5 to fc96636 Compare April 16, 2025 10:55
@HeikoKlare
Copy link
Contributor Author

All comments have been resolved. If no one objects on this, I plan to merge this by end of today.

Copy link
Member

@HannesWell HannesWell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, looks good to me.

@HeikoKlare HeikoKlare force-pushed the disabled-extraction-cleanup branch 2 times, most recently from ac5af8e to cd9e2d7 Compare April 16, 2025 18:34
@HeikoKlare
Copy link
Contributor Author

Thank you, @HannesWell!
I have just finally tested all configurations on all OSes and found that the existing algorithm for Linux is kind of wrong. More precisely, it ignores the fact that alpha values are also encoded in the RGB values. This led to wrong results, in particular making the icon background (which is supposed to be transparent) non-transparent. I have adapted the algorithm to properly reflect that fact. It then produces the expected results for all configurations also on Linux.

Copy link
Member

@HannesWell HannesWell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. Thanks for finding it.

@HeikoKlare HeikoKlare force-pushed the disabled-extraction-cleanup branch 2 times, most recently from bc84800 to 46faeaf Compare April 17, 2025 07:25
@HeikoKlare HeikoKlare force-pushed the disabled-extraction-cleanup branch 2 times, most recently from e4d89ec to 1ee3c47 Compare April 17, 2025 11:32
Each OS-specific implementation of the Image class has its own
implementation of an algorithm to calculate a disabled representation of
a given image. In addition, the algorithm used on Windows and MacOS
produces bad results, which is why usually pre-generated disabled icons
are used.

This change centralizes the implementations of those algorithms in
ImageColorTransformers. The implementations used for the pre-generated
disabled icons is added as default algorithm with an enhanced and the
existing GTK-conforming algorithms being provided as options.

Co-authored-by: Manuel Killinger <Manuel.Killinger@vector.com>
@HeikoKlare HeikoKlare force-pushed the disabled-extraction-cleanup branch from 1ee3c47 to 677dd56 Compare April 17, 2025 13:43
@HeikoKlare
Copy link
Contributor Author

There was a successful Jenkins build without any new isues for this PR yesterday: https://ci.eclipse.org/releng/job/eclipse.platform.swt/job/PR-1936/7/
And nothing but an added comment and rebases on master changed since back then.

Thus merging despite Jenkins build failing due to https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/issues/5893

@HeikoKlare HeikoKlare merged commit 4f30b29 into eclipse-platform:master Apr 17, 2025
10 of 12 checks passed
@HeikoKlare HeikoKlare deleted the disabled-extraction-cleanup branch April 17, 2025 14:08
@HeikoKlare
Copy link
Contributor Author

Since Jenkins build failed for the PR: the subsequent master build after merging was successful has no new issues (https://ci.eclipse.org/releng/job/eclipse.platform.swt/job/master/1108/)

HeikoKlare added a commit to HeikoKlare/www.eclipse.org-eclipse that referenced this pull request Apr 26, 2025
This contributes an N&N informing about the icon disablement algorithm
in SWT being improved and made configurable and the according removal of
the usage of pre-generated disabled icons.

See eclipse-platform/eclipse.platform.swt#1936
HeikoKlare added a commit to HeikoKlare/www.eclipse.org-eclipse that referenced this pull request Apr 26, 2025
This contributes an N&N informing about the icon disablement algorithm
in SWT being improved and made configurable and the according removal of
the usage of pre-generated disabled icons.

See eclipse-platform/eclipse.platform.swt#1936
HeikoKlare added a commit to HeikoKlare/www.eclipse.org-eclipse that referenced this pull request May 6, 2025
This contributes an N&N informing about the icon disablement algorithm
in SWT being improved and made configurable and the according removal of
the usage of pre-generated disabled icons.

See eclipse-platform/eclipse.platform.swt#1936
HeikoKlare added a commit to HeikoKlare/www.eclipse.org-eclipse that referenced this pull request May 6, 2025
This contributes an N&N informing about the icon disablement algorithm
in SWT being improved and made configurable and the according removal of
the usage of pre-generated disabled icons.

See eclipse-platform/eclipse.platform.swt#1936
HeikoKlare added a commit to eclipse-platform/www.eclipse.org-eclipse that referenced this pull request May 6, 2025
This contributes an N&N informing about the icon disablement algorithm
in SWT being improved and made configurable and the according removal of
the usage of pre-generated disabled icons.

See eclipse-platform/eclipse.platform.swt#1936
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants