Bug 310387 - copying new Image(Device device, String filename) can result in black background (was: Black background for icons in Annotations Preference Page)
Summary: copying new Image(Device device, String filename) can result in black backgro...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.6   Edit
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Target Milestone: 4.15 M3   Edit
Assignee: Sravan Kumar Lakkimsetti CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
: 549210 551605 (view as bug list)
Depends on: 545032
Blocks:
  Show dependency tree
 
Reported: 2010-04-25 11:45 EDT by Ralf Ebert CLA
Modified: 2020-09-23 02:08 EDT (History)
12 users (show)

See Also:


Attachments
matching_tags.png (21.36 KB, image/png)
2010-04-25 11:45 EDT, Ralf Ebert CLA
no flags Details
sample icon (70 bytes, image/gif)
2011-04-28 15:20 EDT, Nick Sandonato CLA
no flags Details
sample icon with black (82 bytes, image/gif)
2011-04-28 15:21 EDT, Nick Sandonato CLA
no flags Details
sample icon with blue (123 bytes, image/gif)
2011-04-29 16:05 EDT, Markus Keller CLA
no flags Details
Testbed (9.88 KB, application/x-zip)
2011-05-16 11:19 EDT, Markus Keller CLA
no flags Details
Screenshots of testbed on Windows, Cooca, GTK (220.39 KB, image/png)
2011-05-16 11:24 EDT, Markus Keller CLA
no flags Details
color problems with patch (293.69 KB, image/png)
2019-08-21 06:51 EDT, Lakshmi P Shanmugam CLA
no flags Details
As requested screen dump - this time with WB 1.92 and Eclipse 2019 12 (529.31 KB, image/jpeg)
2019-11-11 03:51 EST, David Garratt CLA
no flags Details
Comparison 1.9.2 v 1.9.3 screen dumps MacOS (2.62 MB, image/jpeg)
2020-01-30 09:28 EST, David Garratt CLA
no flags Details
1.9.3 with Eclipse 4.1.5 (501.25 KB, image/gif)
2020-02-01 03:13 EST, David Garratt CLA
no flags Details
Palette Display Example WIndowBuilder 1.9.4 Eclipse 2020 09 (110.26 KB, image/gif)
2020-09-23 02:01 EDT, David Garratt CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Ebert CLA 2010-04-25 11:45:28 EDT
The icon for matching tags annotation is shown with a black background on OS X; using Eclipse Web Developer Tools	3.2.0.v201004210707. See attached screenshot.
Comment 1 Ralf Ebert CLA 2010-04-25 11:45:58 EDT
Created attachment 166019 [details]
matching_tags.png
Comment 2 Nick Sandonato CLA 2011-04-28 15:20:49 EDT
Created attachment 194307 [details]
sample icon
Comment 3 Nick Sandonato CLA 2011-04-28 15:21:18 EDT
Created attachment 194308 [details]
sample icon with black
Comment 4 Nick Sandonato CLA 2011-04-28 15:35:44 EDT
This looks like it may be a problem with the AnnotationsConfigurationBlock#getImage when copying the data from the source images.

I've attached two images. One is a red circle with a transparent background. The other is the same GIF but with a small, black dot in the red circle. If an annotation uses the red image, the transparency appears as normal.  If the red image with the black dot is used, the background of the annotation icon becomes black.

The transparency works correctly in Windows.
Comment 5 Dani Megert CLA 2011-04-29 05:43:43 EDT
Markus can you check whether it's a bug in AnnotationsConfigurationBlock.getImage(AnnotationPreference) or SWT? Thanks.
Comment 6 Markus Keller CLA 2011-04-29 16:03:46 EDT
The code in AnnotationsConfigurationBlock#getImage(..) should not do a pixel-wise copy in this case, since both images have the same size. If I add this, then the bug is gone:

	} else if (data.height == SIZE && data.width == SIZE) {
		copy= new Image(image.getDevice(), image, SWT.IMAGE_COPY);


Nevertheless, there's a bug in SWT that need to be addressed: When I change the color in the "sample icon with black" to blue, then the bug is also gone.

To reproduce, you can e.g. import o.e.jdt.ui and then add the icon to the "org.eclipse.jdt.ui.occurrences.write" annotation (in the plugin.xml, add line
            icon="$nl$/icons/full/test_after.gif"
and put the icon there). Then open the Annotations preference page.

To debug, set a breakpoint in ACB#getImage(..) with condition:
"org.eclipse.jdt.ui.occurrences.write".equals(preference.getAnnotationType())
Comment 7 Markus Keller CLA 2011-04-29 16:05:03 EDT
Created attachment 194407 [details]
sample icon with blue
Comment 8 Markus Keller CLA 2011-05-10 05:50:24 EDT
We've worked around the problem in case the icon is 16x16 pixels (bug 345180). To reproduce in HEAD, you have to revert attachment 195121 [details] or use an icon with smaller dimensions.
Comment 9 Markus Keller CLA 2011-05-16 11:19:47 EDT
Created attachment 195741 [details]
Testbed

It turned out this area is shaky on all platforms, so I wrote a little test bed that shows all the problems we encountered.
Comment 10 Markus Keller CLA 2011-05-16 11:24:35 EDT
Created attachment 195742 [details]
Screenshots of testbed on Windows, Cooca, GTK

On Cocoa, the problem with the black background only shows up if the Image(Device device, String filename) constructor is used and then the code in SnippetBug310387#createCenteredTableItem(String) is used to copy the image.
Comment 11 Eric Williams CLA 2018-05-16 15:44:24 EDT
Still reproducible on GTK3.22, 4.8 M7, and Fedora 28.
Comment 12 Eric Williams CLA 2019-06-06 10:58:35 EDT
(In reply to Markus Keller from comment #10)
> Created attachment 195742 [details]
> Screenshots of testbed on Windows, Cooca, GTK
> 
> On Cocoa, the problem with the black background only shows up if the
> Image(Device device, String filename) constructor is used and then the code
> in SnippetBug310387#createCenteredTableItem(String) is used to copy the
> image.

The native ImageLoader implementation from bug 545032 fixes this issue on GTK.
Comment 13 Eclipse Genie CLA 2019-07-22 01:24:13 EDT
New Gerrit change created: https://git.eclipse.org/r/146428
Comment 14 Lakshmi P Shanmugam CLA 2019-08-21 06:51:53 EDT
Created attachment 279651 [details]
color problems with patch

The patch fixes the black background in test_after.gif images. But it causes a few color issues as shown in the screenshot.
Comment 16 Eclipse Genie CLA 2019-10-16 04:30:43 EDT
New Gerrit change created: https://git.eclipse.org/r/151142
Comment 18 Sebastian Ratz CLA 2019-10-18 07:07:30 EDT
This seems to be again broken in the latest I-Build:
https://download.eclipse.org/eclipse/downloads/drops4/I20191016-1800/gitLog.php
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/log/

So the problems with the colors are back.

I also noticed issues with transparency.
Comment 19 Eclipse Genie CLA 2019-10-21 11:30:19 EDT
New Gerrit change created: https://git.eclipse.org/r/151400
Comment 21 Lakshmi P Shanmugam CLA 2019-10-22 05:31:41 EDT
@Sravan,
Why are there multiple commits/reverts of the same change from https://git.eclipse.org/r/146428?
As mentioned in comment#14 the gerrit patch causes color and transparent issues. They should be fixed before committing the change.
Comment 22 Sravan Kumar Lakkimsetti CLA 2019-10-28 03:49:18 EDT
I am at loss on how to proceed on this problem. Any help from community os gratly appreciated.
Comment 23 David Garratt CLA 2019-10-30 08:53:45 EDT
Does the fact that when I run an older version of Eclipse 2019-03 - I don't get the problem help ?
Comment 24 Wim Jongman CLA 2019-11-10 16:21:01 EST
*** Bug 549210 has been marked as a duplicate of this bug. ***
Comment 25 Wim Jongman CLA 2019-11-10 16:21:41 EST
*** Bug 551605 has been marked as a duplicate of this bug. ***
Comment 26 David Garratt CLA 2019-11-11 03:51:42 EST
Created attachment 280588 [details]
As requested screen dump - this time with WB 1.92 and Eclipse 2019 12

As requested screen dump - this time with WB 1.92 and Eclipse 2019 12
Comment 27 David Garratt CLA 2020-01-02 16:11:52 EST
Just wondered if there has been any progress on this issue ?
Comment 28 David Garratt CLA 2020-01-13 23:53:00 EST
Any news on this. I'm unable to move beyond 2019-03 on MacOS with this issue.
Comment 29 Sravan Kumar Lakkimsetti CLA 2020-01-16 08:16:59 EST
When an image is created with ImageData the transparency is not handled properly on Mac. 

the problem is there in this method https://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/bundles/org.eclipse.swt/Eclipse%20SWT/cocoa/org/eclipse/swt/graphics/Image.java#n682

At this particular line a new image data is created which included alpha data. but the alpha data is completely ignored in the subsequent execution. This is resulting in black background

Need help in separating alpha data into a mask. Any help is appreciated
Comment 30 Eclipse Genie CLA 2020-01-20 07:44:44 EST
New Gerrit change created: https://git.eclipse.org/r/156180
Comment 32 Sravan Kumar Lakkimsetti CLA 2020-01-20 08:51:40 EST
Merged to master
Comment 33 Lakshmi P Shanmugam CLA 2020-01-30 07:20:13 EST
The change seems to cause problems in breadcrumb view - Bug 559705.
Comment 34 David Garratt CLA 2020-01-30 09:28:57 EST
Created attachment 281658 [details]
Comparison 1.9.2 v 1.9.3 screen dumps MacOS

I have updated Eclipse 2019-12 to version 1.9.3 and attached screen dumps comparing the same windowbuilder toolbars before and after.
Comment 35 Wim Jongman CLA 2020-01-30 12:11:32 EST
(In reply to Dave Garratt from comment #34)
> Created attachment 281658 [details]
> Comparison 1.9.2 v 1.9.3 screen dumps MacOS
> 
> I have updated Eclipse 2019-12 to version 1.9.3 and attached screen dumps
> comparing the same windowbuilder toolbars before and after.

Dave, we know 2019-12 has the issue. It would be nice if you could compare to the latest build from here:

https://download.eclipse.org/eclipse/downloads/

e.g.

https://download.eclipse.org/eclipse/downloads/drops4/I20200129-1800/
Comment 36 David Garratt CLA 2020-01-30 13:39:15 EST
WindowBuilder 1.9.2 seems to display ok with the version of Eclipse you suggest although I have other non related problems which I can elaborate on if your interested,
Comment 37 Wim Jongman CLA 2020-01-31 05:48:48 EST
(In reply to Dave Garratt from comment #36)
> WindowBuilder 1.9.2 seems to display ok with the version of Eclipse you
> suggest although I have other non related problems which I can elaborate on
> if your interested,

What about WB 1.9.3 on that version?

Please file issues for the other non-related problems.
Comment 38 David Garratt CLA 2020-02-01 03:12:23 EST
Just tried 1.9.3 with Version: 2020-03 (4.15)
Build id: I20200131-1800 and it looks ok (from the perspective of WindowBuilder) but I'm not sure what to expect from Eclipse itself which seems to be missing lots of screens/properties. For example there are no views for "Servers" which can be opened or added so my servlet won't work. The Java Swing app complained about the Java JRE which had previously been defined in a facet but the properties of the project seemed to only contain about 50% of the options I would normally see and facet was not present.

Anyway = I have attached a screen dump of WindowBuilder.

Let me know what I should expect from this build of eclipse. I don't want to report things if it's not expected to work fully as yet. Normally I would use the Java EE version of Eclipse
Comment 39 David Garratt CLA 2020-02-01 03:13:15 EST
Created attachment 281673 [details]
1.9.3 with Eclipse 4.1.5
Comment 40 Wim Jongman CLA 2020-02-02 07:45:23 EST
(In reply to Dave Garratt from comment #38)
> 
> Let me know what I should expect from this build of eclipse. I don't want to
> report things if it's not expected to work fully as yet. Normally I would
> use the Java EE version of Eclipse

Hey Dave. This version of Eclipse is just the SDK. It does not have all the bells and whistles of the various packages. 

The various packages you can download, all take the SDK and put their specific projects on top of that.

I can't find a nightly download for the packages [1] so I filed [2].

The earliest developer package available is M3 (Feb 28) [3]

[1] https://www.eclipse.org/epp/
[2] https://bugs.eclipse.org/bugs/show_bug.cgi?id=559766
[3] https://wiki.eclipse.org/Category:SimRel-2020-03
Comment 41 Wim Jongman CLA 2020-02-02 07:51:52 EST
(In reply to Sravan Kumar Lakkimsetti from comment #32)
> Merged to master

Thanks, Sravan!
Comment 42 David Garratt CLA 2020-02-04 04:09:06 EST
SO - ignore my comments about eclipse options looking different - that was because I am used to using the EE edition. The graphics problem appears to be fixed.

Dave
Comment 43 Sravan Kumar Lakkimsetti CLA 2020-02-18 06:13:19 EST
Marking it verified based on comment 42
Comment 44 Wim Jongman CLA 2020-02-18 06:45:22 EST
Well done Sravan, this was not an easy thing to fix.
Comment 45 Jochen Kemnade CLA 2020-04-01 03:27:56 EDT
We're experiencing this issue with JFace's CompositeImageDescriptor in our RCP application based on 2019-06. Is there any alternative to updating the target platform?
Comment 46 Wim Jongman CLA 2020-04-01 04:12:24 EDT
(In reply to Jochen Kemnade from comment #45)
> We're experiencing this issue with JFace's CompositeImageDescriptor in our
> RCP application based on 2019-06. Is there any alternative to updating the
> target platform?


Yes, you can make a "feature patch".
Comment 47 Jochen Kemnade CLA 2020-04-01 05:41:04 EDT
Thanks for the hint. Just to be sure that I'm trying to do the right thing: I would try to create a feature patch for the org.eclipse.swt.cocoa.macosx.x86_64 bundle and add a patched Image.class file?
Comment 48 Wim Jongman CLA 2020-04-01 06:02:37 EDT
(In reply to Jochen Kemnade from comment #47)
> Thanks for the hint. Just to be sure that I'm trying to do the right thing:
> I would try to create a feature patch for the
> org.eclipse.swt.cocoa.macosx.x86_64 bundle and add a patched Image.class
> file?

Yes.
Comment 49 Jochen Kemnade CLA 2020-04-02 05:34:20 EDT
(In reply to Wim Jongman from comment #48)
I'm having trouble getting this to work, maybe because org.eclipse.swt.cocoa.macosx.x86_64 is a fragment. It doesn't seem possible to reference it in the feature patch's feature.xml

...
   <requires>
      <import feature="org.eclipse.swt.cocoa.macosx.x86_64" version="3.111.0.v20190605-1801" patch="true"/>
   </requires>
...
Comment 50 David Garratt CLA 2020-09-23 01:57:05 EDT
This bug has re-appeared now that I have installed Eclipse 2020 09 on Mac with WindowBuilder 1.9.4.202009181620
Comment 51 David Garratt CLA 2020-09-23 02:01:51 EDT
Created attachment 284229 [details]
Palette Display Example WIndowBuilder 1.9.4 Eclipse 2020 09

Note this time the issue seems limited to the palette and does not affect the toolbar.
Comment 52 David Garratt CLA 2020-09-23 02:08:17 EDT
I have created a new ticket Bug 567266