Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 126553 - [Field Assist] light bulb image looks ugly on white background
Summary: [Field Assist] light bulb image looks ugly on white background
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 M6   Edit
Assignee: Susan McCourt CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 29994
Blocks:
  Show dependency tree
 
Reported: 2006-02-06 08:47 EST by Dani Megert CLA
Modified: 2006-03-28 14:53 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2006-02-06 08:47:23 EST
N20060206-0010 + org.eclipse.workbench from HEAD

When trying out the patch in bug 124873 I noticed that the light bulb looks fat/ugly.

I assume you copied the Platform Text image. This image uses color transparency and hence the decoration composite color shine through. You should either adapt the composite's background or try out the new Composite.setBackgroundMode(SWT.INHERIT_DEFAULT) API.
Comment 1 Susan McCourt CLA 2006-02-06 20:25:55 EST
Good eye!
The composite's color was being set to white by the client (the cell editor.)  However this was done directly on the control, so the label containing the decoration was not updated. This actually exposed the need for new API
DecoratedField.setBackgroundColor(Color color)

Normally the default colors are appropriate, but if a client wants to use a non-default color for the field background, then you want to set it on the field so that all the related widgetry is updated.

Fixed >20060206
Comment 2 Dani Megert CLA 2006-02-07 03:16:42 EST
Can you explain your fix a bit more. Couldn't you just use the proposed new API? I tried it out by setting it on the form and it worked as expected.
Comment 3 Susan McCourt CLA 2006-02-07 12:21:28 EST
The decorators themselves are shown inside a Label control.  The label's background is where the ugliness was coming from.  Label doesn't support the new API.
Comment 4 Dani Megert CLA 2006-02-07 12:34:57 EST
OK, maybe the code changed inbetween. I've used setBackgroundMode(SWT.INHERIT_DEFAULT) on DecoratedField.form and it did the trick.

Comment 5 Susan McCourt CLA 2006-02-07 12:55:44 EST
I'll be honest, I didn't try it since Label doesn't support the new API.  I just assumed that setting it only on the composite would not be enough.  It would be nice not to have new API introduced for this if the SWT does what I want, but I'll have to check it on all platforms...so reopening to check for M5 if possible.
Comment 6 Susan McCourt CLA 2006-02-12 18:21:53 EST
I just came back to this one in order to remove the setBackground API on DecoratedField if it is not necessary.  I removed the API and before even trying the Composite.setBackgroundMode API, I observe that the extra gray pixels are now gone.  I saw the problem last week so I do know what I'm looking for.  I cannot explain why it has now gone away.  

Tested on Win and Mac, and there are no extra gray/fuzzy parts on the light bulb when the background white.  Moving this to M6 for further investigation on Linux and to ensure that it all looks okay after SWT stabilizes for M5.  Also, the setBackgroundMode is still marked experimental although UI forms uses it. 
Comment 7 Susan McCourt CLA 2006-02-14 11:13:58 EST
note to self: see SWT bug #29994
Comment 8 Susan McCourt CLA 2006-03-01 18:39:05 EST
Fixed I-20060301.  I've just verified it on Win, Linux, and Mac.

In M5, I used code that set the label's background color to the composite background when it was created.  This "fixed" the problem as long as the decorated field color was set before any decorations were created, but would not keep the colors up to date afterward.

Using the new SWT background mode support allows me to remove code that sets the label color, thus always inheriting the composite color.  Marking this bug dependent on bug #29994 since that API is still marked "under construction."

Verified that the bulb looks correct on Windows, Linux GTK, and Mac.
Comment 9 Susan McCourt CLA 2006-03-28 14:53:02 EST
verified on I20060328-0010, win XP in patched new interface wizard.
(note that this particular use case is not in M6, but is useful for verifying the bulb icon against a white background)