Creation of disabled icons #1619
Replies: 6 comments 8 replies
-
I'm not 100% sure what difference you look at exactly but that's most likely because GTK uses the OS image codecs and thus provides support for far more image types and better compatibility. E.g. if the "shared" codecs are used there will be no SVG rendering, issues with animated gifs and etc. problems that lead to that work. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=545032 for details. |
Beta Was this translation helpful? Give feedback.
-
Would you show the differences between windows/linux? Also please point to exact difference in code so I don't end up thinking of smth else than you. |
Beta Was this translation helpful? Give feedback.
-
Because you can only get "something that looks disabled according to what the os offers" but usually one maybe wants to have more control e.g. getting a nicer look&feel. Lets assume you have a checkbox that is a black bordered box with white background, if you "disable" that image by usually making it gray, it will look exactly the same, so you cant distinguish an unchecked box from a disabled one. So in this case one might decide to give the box a light-gray border, or a different background color as a disabled image. |
Beta Was this translation helpful? Give feedback.
-
I am currently working on the icon-disabling mechanism to enhance the look for icons with modern flat designs. The current algorithm maps colors to only 2 gray tones, where one is the background color, making some icons invisible altogether. Ill provide a snippet with a proposition of new disabling algorithms in a separate issue. To answer question 2:
|
Beta Was this translation helpful? Give feedback.
-
I didn't know this. Cool. |
Beta Was this translation helpful? Give feedback.
-
The disabled icons automatically generated by the current |
Beta Was this translation helpful? Give feedback.
-
Currently, there are two methods for integrating disabled icons into Eclipse:
Pre-created Disabled Icons:
Disabled icons are generated outside Eclipse and stored in the image repository. These icons are then referenced in the
plugin.xml
file using thedisabledIcon
attribute. For generating disabled icons, the [Image-Renderer](https://github.com/eclipse-platform/eclipse.platform.images/blob/master/org.eclipse.images.renderer/src/main/java/org/eclipse/images/renderer/RenderMojo.java) from the Eclipse Images repository can be used. This approach involves post-processing the icons with a third-party library after rasterization.Runtime Conversion:
If the
disabledIcon
attribute in theplugin.xml
file is not set, the original (enabled) icon is automatically converted to a disabled icon at runtime using theorg.eclipse.jface.resource.DerivedImageDescriptor
. This involves loading the original icon and applying theorg.eclipse.swt.graphics.Image.Image(Device, Image, int)
constructor with theSWT.IMAGE_DISABLE
flag. Here, too, the disabled effect is achieved through post-processing.Questions about the Current Workflow
Since both methods for creating disabled icons rely on post-processing, why not streamline the process by using only the existing automatic method and removing all pre-created disabled icons from the repository?
Why is the implementation of the
Image
constructor different for GTK compared to other operating systems? Could we unify the constructor's behavior across all platforms to ensure consistent results?I had planned to introduce an automatic method for generating disabled icons by pre-processing SVGs and then rasterizing them at runtime. This method would apply a filter to the SVG, ensuring that the icon appears disabled after rasterization. This approach would allow loading disabled icons directly via the
DerivedImageDescriptor
, eliminating the need for post-processing.My solution works well and is likely much faster than the current automatic conversion. However, it introduces a problem: The visual appearance of disabled icons would differ across platforms. If calibrated to match Windows icons, it would appear inconsistent on GTK, and vice versa.
Given these inconsistencies, I will postpone implementing this solution until a unified approach for disabling icons is introduced to eclipse. Once there is a consistent method across platforms, I can fine-tune the filter to ensure it aligns with the style for disabled icons.
Beta Was this translation helpful? Give feedback.
All reactions