Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Won't Fix
-
10.0
-
None
-
Windows, Linux, and MacOS
Description
To look good on HiDPI/Retina displays, the NetBeans IDE, and NetBeans Platform (RCP) applications, will eventually need to provide high-resolution versions of various image asset (typically icons). In Swing, multi-resolution image assets are supported via the MultiResolutionImage class; such images are automatically loaded by methods such as Toolkit.getImage based on a standard naming convention. For instance, on MacOS, Toolkit.getImage("myicon.png") will also load the file "myicon@2x.png" if present, returning a MultiResolutionImage (implemented in JDK-8011059). NetBeans' ImageUtilities.loadImage and friends should do the same.
The same naming convention for multi-resolution image assets should be used as in the JDK. See Philip Race's comment on JDK-8151787 :
The proposed name convention for splash screens and other multi-res images is @125pct @150pct @200pct @2x @250pct @300pct @3x
ie @2x and @3x are supported as synonyms for @200pct and @300pct respectively and also because we already supported @2x on retina Mac.
On the naming convention, see also JDK-8090575. Also make sure to retain the ability to add a "_dark" suffix for dark LAFs.
As far as I know, only MacOS currently supports the automatic loading of such assets via Toolkit.getImage, but both Windows and MacOS (and Linux?) support the underlying MultiResolutionImage class. So it's already possible to implement this on the latest JDK. Note, however, that we should probably wait for JDK-8212226 to be fixed before enabling this on Windows.
As part of this patch, other ImageUtilities methods such as createDisabledIcon, createDisabledImage, and mergeImages should also be updated to support both MultiResolutionImage and the new org.openide.util.VectorIcon class (introduced at https://github.com/apache/incubator-netbeans/pull/859/files ). Emilian Bold has done some work on this in the past; see https://github.com/emilianbold/nextbeans/commit/0f99dba0c1b3e8e0bc4e7cec407b53d30e85ead1 . Eirik Bakke also has a Pull Request for createDisabledIcon in particular, which works with the VectorIcon class and any other Icon instance.
Last, note that there are two ways to create icons that look good on HiDPI displays: either by using MultiResolutionImage, or by hand-painting vector graphics in a custom implementation of the Icon class. This issue deals with the MultiResolutionImage approach; the vector painting approach is supported via the existing helper class org.openide.util.VectorIcon. Both approaches are valid and should be supported by the NetBeans Platform. (Update on 2019-05-27: There's a third approach, which is to supply each icon as an SVG file. That one is probably the better approach. See https://issues.apache.org/jira/browse/NETBEANS-2604 .)
Attachments
Issue Links
- mentioned in
-
Page Loading...