Bug 506058 - Incorrect and inconsistent rendering of disabled images
Summary: Incorrect and inconsistent rendering of disabled images
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.6   Edit
Hardware: PC All
: P3 normal with 3 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-17 05:31 EDT by Felix Hirsch CLA
Modified: 2021-12-07 10:42 EST (History)
8 users (show)

See Also:


Attachments
Created disabled images for different controls for all platforms (131.08 KB, image/png)
2016-10-17 05:31 EDT, Felix Hirsch CLA
no flags Details
Example to create disabled images (3.81 KB, application/octet-stream)
2016-10-17 05:34 EDT, Felix Hirsch CLA
no flags Details
Disabled images in Eclipse 2020-09 I20200610-1800 (845.93 KB, image/png)
2020-06-15 17:51 EDT, Felix Hirsch CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Felix Hirsch CLA 2016-10-17 05:31:27 EDT
Created attachment 264885 [details]
Created disabled images for different controls for all platforms

The rendering of disabled images is partly incorrect and inconsistent within each system. 
Under windows the rendering methods create mostly very poor images. 
In some cases SWT methods doesn't behave like they are documented and at the same time the eclipse user interface guidelines are violated as well.

I attach a PNG file to this report which shows the results of my analysis. I will also attach a zip file containing a java example with which I created the results from within a Eclipse 4.6.1 Neon IDE for each platform.


Let me explain my statement.

I took a closer look how disabled images are rendered with SWT on the following platforms:
* Windows 7 and 10
* Linux RedHat 6.8 and Ubuntu 16.10 (only for GTK2, see bug #495004) 
* MacOS X (Yosemite 10.10.3)

In my analysis I considered the implicite (and if available, also the explicite) rendering methods for the controls 
* ToolItem
* Label
* Button 
* and MenuItem.

Further I also checked how the Image class copy constructor renders with the flags 
* SWT.IMAGE_DISABLE and 
* SWT.IMAGE_GRAY.


Windows
-------
* The rendering under Windows is in most cases (sorry for my hard words) ugly or as stated in the eclipse user interface guidelines very "poor". 

* The MenuItem differs here from all other controls. The images for MenuItems are rendered NICE using a system internal way. 

* All other implicitly rendered disabled images under Windows are rendered using the copy constructor of the Image class with the flag SWT.IMAGE_DISABLE, which is poor, but at least *consistently poor over all PLATFORMS*. 

* Using the constant SWT.IMAGE_GRAY is also consistently the same for all platforms, but the created images look definitely nicer.

* It is currently not possible to enhance the quality of disabled images in Buttons and Label. For the ToolItem there exists a workaround:



Workaround for ToolItems (specified for all PLATFORMS)
------------------------------------------------------
* For ToolItems one can use the interface method ToolItem#setDisabledImage to explicitly provide a disabled image. This way is also suggested in the user interface guidelines for ALL PLATFORMS. 

* Under Windows this works as it is described.



Linux and MacOS
---------------
* Under Linux and MacOS the ToolItem interface methods for providing disabled images, as described above, are ignored (Linux) or the images are taken but changed by the system (MacOS). 

* Therefore the interface contract of the class ToolItem is violated and the "Eclipse User Interface Guidelines" described in https://wiki.eclipse.org/User_Interface_Guidelines#States can never be followed while using the SWT implementation under Linux and MacOS.

Let me explain and support that last statement. 

In the Javadoc for the method ToolItem#setDisabledImage states:
	
	"Sets the receiver's disabled image to the argument, which may be null indicating that no disabled image should be displayed. The disabled image is displayed when the receiver is disabled."

And in the eclipse user interface guidelines it is written:
	
	"It is important to implement the graphical versions of the disabled state for toolbar and local toolbar icons. The quality and legibility of algorithmically rendered disabled icons is poor and they are not consistent with the majority of other tools that use the graphical versions."

In both documentations there is no note made about platform dependent behavior and further the interfaces documentation says that the provided images WILL BE USED for the control when disabled.



Let me summarize and complete the issue topics from this report
---------------------------------------------------------------
* Windows renders disabled images very POOR except for MenuItems.

* There is no way to render disabled images in all cases with the method/algorithm (Windows) or the user/developer does not have any access to the internal method (Linux, MacOS).

* The suggested workaround to use explicitly provided disabled images is only available for ToolItem controls but is MISSING for Label, Button and MenuItem controls.

* Linux IGNORES explicitly provided disabled images for ToolItems (Violation of style guide and interface contract)

* MacOS uses explicitly provided disabled images for ToolItems but CHANGES them (Violation of style guide and interface contract)

* Under MacOS the label image is not displayed in a disabled way. This might be OK, since a label is a none-interactive control and in the Javadoc it is stated, that the control is displayed only "typically" in "grayed" look.


Suggestions
-----------
* With currently available Windows versions it should be possible to use better internal rendering methods. This is actually already done for the MenuItem. All controls under Windows should render implicitly disabled images NICELY using ONE CENTRALIZED METHOD.

* The user of the framework should be able to create NICE images in the SAME disabled look. Therefore the Image copy constructor should use the SAME NICE method. This is IMPORTANT, as one can create her/his own controls which  should have the same look and feel possibilities for a disabled state. 

* It would also be a great achievement, if one could provide alternative strategies at runtime to explicitly specify the algorithm which is used for rendering disabled images.

* I would prefer to DEPRECATE (REMOVE) the "workaround" interface for ToolItems OR at least to provide all image containing controls with this interface. But better have it marked deprecated. 
If the first suggestion ("Nicer disabled images and a central way to access or even specify the rendering method") is fulfilled, there is no need to keep the workaround interface any longer in my opinion.

* As long as the workaround will stay active and is not marked as deprecated in the interface, Linux and MacOS should behave like the contract states.
Comment 1 Felix Hirsch CLA 2016-10-17 05:34:52 EDT
Created attachment 264891 [details]
Example to create disabled images

Run the application from within the eclipse ide since it uses resources from org.eclipse.ui
Comment 2 Felix Hirsch CLA 2016-10-19 03:24:02 EDT
There is a relationship to #302918. 

This bug is also about the misbehaviour of ToolItem#setDisabledImage under Linux.
Comment 3 Lars Vogel CLA 2020-06-12 06:45:44 EDT
Sorry Felix for never replying to your bug report. Can you still observe these bad rendering in the lastest 2020-09 release? If yes, could you create Gerrits for suggested improvements?
Comment 4 Felix Hirsch CLA 2020-06-12 08:35:50 EDT
Hi Lars,

thanks for the answer. I can run the test again with the latest release, but as far as I searched online, I can only find a download of 2020-06 RC1. 

Did you mean this version or can you explain me where I get a copy of a 2020-09 milestone?

Thanks
Comment 5 Lars Vogel CLA 2020-06-12 09:27:49 EDT
(In reply to Felix Hirsch from comment #4)
> Hi Lars,
> 
> thanks for the answer. I can run the test again with the latest release, but
> as far as I searched online, I can only find a download of 2020-06 RC1. 
> 
> Did you mean this version or can you explain me where I get a copy of a
> 2020-09 milestone?
> 
> Thanks

Hi Felix, https://download.eclipse.org/eclipse/downloads/ has the latest I-Build.
Comment 6 Felix Hirsch CLA 2020-06-15 17:51:38 EDT
Created attachment 283290 [details]
Disabled images in Eclipse 2020-09 I20200610-1800

The behavior changed a little bit, but IMHO it is still not good.

Implicitly (automatic) rendering of disabled images on Windows 10 looks still bad, as I see it.

Explicit rendering of ToolItem-images on Linux now at least uses the provided disabled images but the system changes them (they are slightly brighter than the provided ones). Nevertheless the look of most implicitly disabled images differ from the style of the disabled images which are provided explicitly (See in the provided attachment).

And I wonder why the style guide convention of providing explicitly disabled images counts only for ToolItems? Disabled images should look the same for any context (Label, Button, ToolItem, MenuItem, Canvas, ...).

And in my opinion there would be no need for the style guide convention of providing explicit disabled images at all, if the implicitly rendering of all disabled images in Windows would be good (like MenuItem).


Sadly the whole topic doesn't seem to interest anyone or hardly anyone here. 
But if you want to know what I think - here are my ideas for improvement:

1) SWT automatic/implicitly rendering of disabled images under Windows should be the same for all contexts and the created images should look good (quality like MenuItem today).
     
2) Style guide convention and API of providing explicitly a disabled image should count and work for all contexts (Menu, Tool, Button, Label, Canvas, ...) (...OR it should be removed)

Lars I am really sorry, I looked into the GTK- and Win32-SWT code and I have not the "graphics"-API and -programming skills (OS specific and Java) to provide a patch or a solution. And when we are talking about the Style-Guide and the API of items and controls I am not the right person either.