Bug 262804

Summary: [dark] Invert icon consistently
Product: ide Reporter: markiewb
Component: UIAssignee: markiewb
Status: RESOLVED FIXED QA Contact: issues <issues.netbeans.org>
Priority: P3 CC: markiewb
Version: 7.4Keywords: L&F, NETFIX, UI
Target Milestone: 8.2   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Issue Type: DEFECT Exception Report:
Attachments: Patch
Patch in action
Patch v2 (including support for branding)
patch2-darcula-laf-withinvertedicons.png
patch2-darcula-laf.png
patch2-darkmetal-laf.png
patch2-darknimbus-laf.png
patch2-windows-laf.png

Description markiewb 2016-07-13 20:07:45 UTC
When using the Dark Metal Theme / Darcula Theme (with invert icons option set) the colors of the icons are "inverted". This is done via setting a ImageFilter to the UIManager.put("nb.imageicon.filter", new DarkIconFilter()). See
o.n.swing.laf.dark\src\org\netbeans\swing\laf\dark\DarkIconFilter.java

ACTUAL: Only some icons are inverted. 

Inverting is done in org.openide.util.ImageUtilities.loadImageIcon(String, boolean)
But not in org.openide.util.ImageUtilities.loadImage(...)

EXPECTED: All icons are inverted.
Comment 1 markiewb 2016-07-13 20:08:41 UTC
Created attachment 160376 [details]
Patch
Comment 2 markiewb 2016-07-13 20:11:34 UTC
Created attachment 160377 [details]
Patch in action
Comment 3 markiewb 2016-07-13 20:14:24 UTC
I like to provide a patch for that. I have committer rights, but I am not sure about the removal of

assert (tracker.statusID(id, false) == MediaTracker.COMPLETE) : "Image loaded";

from the code. So I need a review of this patch, before it gets committed.

You can see the before-after-comparison-screenshot at https://netbeans.org/bugzilla/attachment.cgi?id=160377
Comment 4 markiewb 2016-07-14 23:10:58 UTC
Created attachment 160393 [details]
Patch v2 (including support for branding)

Here is a new version of the patch.

* simplified code and added doc
* supports brandings like about_nb_dark.png, but only about.png has been requested
* duplicate images like splashscreen, about picture, logos for startpage as _dark-suffixed images (else the about picture and the startpage logos would get inverted too)
* could not find a way to keep "assert (tracker.statusID(id, false) == MediaTracker.COMPLETE) : "Image loaded";"

If there are no objections, I will integrate it on monday.
Comment 5 markiewb 2016-07-14 23:13:17 UTC
Created attachment 160394 [details]
patch2-darcula-laf-withinvertedicons.png
Comment 6 markiewb 2016-07-14 23:13:41 UTC
Created attachment 160395 [details]
patch2-darcula-laf.png
Comment 7 markiewb 2016-07-14 23:13:57 UTC
Created attachment 160396 [details]
patch2-darkmetal-laf.png
Comment 8 markiewb 2016-07-14 23:14:18 UTC
Created attachment 160397 [details]
patch2-darknimbus-laf.png
Comment 9 markiewb 2016-07-14 23:14:46 UTC
Created attachment 160398 [details]
patch2-windows-laf.png
Comment 10 markiewb 2016-07-14 23:26:09 UTC
Note: Need to inform Jirka, that about_nb_dark.png (...) has to be provided, when 8.2 is on release branch.
Comment 11 markiewb 2016-07-14 23:40:10 UTC
*** Bug 235119 has been marked as a duplicate of this bug. ***
Comment 12 markiewb 2016-07-20 22:50:36 UTC
fixed

http://hg.netbeans.org/core-main/rev/121baf524946

* ImageUtilities.loadImageIcon now supports filtering of images using a dark LaF too -> every image loaded by the platform is handled
** if it's a darktheme, then
*** if there exists an image with the postfix "_dark" that image is returned unaltered/unfiltered. For example about.png -> about_dark.png/about_dark_BRANDING.png
*** otherwise load the original image and apply the filter is defined by the LookAndFeel via the filterUIManager.get( "nb.imageicon.filter")
* Duplicate logos for oracle/java/nb in welcome and ide.branding module to look the same as without the patch
* Remove special configuration for dark images from DarkMetal/DarkNimbus-Theme (is now handled by the "_dark"-image serves first approach) (had to update the spec version, else the changes won't apply)
Comment 13 Quality Engineering 2016-07-22 01:51:20 UTC
Integrated into 'main-silver', will be available in build *201607220002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/121baf524946
User: Benno Markiewicz <markiewb@netbeans.org>
Log: #262804 - [dark] Invert icon consistently - ImageUtilities.loadImageIcon supports dark LaFs

* ImageUtilities.loadImageIcon now supports filtering of images using a dark LaF too -> every image loaded by the platform is handled
** if its a darktheme, then
*** if there exists an image with the postfix "_dark" that image is returned unaltered/unfiltered. For example about.png -> about_dark.png/about_dark_BRANDING.png
*** otherwise load the original image and apply the filter is defined by the LookAndFeel via the filterUIManager.get( "nb.imageicon.filter")
* Duplicate logos for oracle/java/nb in welcome and ide.branding module to look the same as without the patch
* Remove special configuration for dark images from DarkMetal/DarkNimbus-Theme (is now handled by the "_dark"-image serves first approach) (had to update the spec version, else the changes won't apply)
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo