Bug 239745 - Retina display support (new icons etc.)
Retina display support (new icons etc.)
Status: NEW
Product: platform
Classification: Unclassified
Component: Window System
8.0
Macintosh Mac OS X
: P3 with 14 votes (vote)
: 8.0.1
Assigned To: Stanislav Aubrecht
issues@platform
:
: 257374 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-12-23 19:30 UTC by kimsp
Modified: 2016-10-10 10:45 UTC (History)
7 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments
The top of the editor (264.44 KB, image/tiff)
2013-12-23 19:34 UTC, kimsp
Details
Image in about dialog (276.20 KB, image/tiff)
2013-12-23 19:35 UTC, kimsp
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kimsp 2013-12-23 19:30:47 UTC
[ BUILD # : 201312230002 ]
[ JDK VERSION : 1.7.0_45 ]

Hi, 

The icons on netbeans are not very pretty on a Retina display. Nor is the
display that shows memory consumption. Please see attached photos. 
We should provide high res images.

Regars
Kim
Comment 1 kimsp 2013-12-23 19:34:24 UTC
Created attachment 143413 [details]
The top of the editor

Note the memory consumption gauge, the html5 icon and the other icons.
Comment 2 kimsp 2013-12-23 19:35:20 UTC
Created attachment 143414 [details]
Image in about dialog

Not how unclear the image is, I can almost see the pixels
Comment 3 Alexandr Scherbatiy 2014-06-16 13:23:47 UTC
Which functionality should be provided by JDK for the NetBeans Retina support?

There is the fix in JDK 8u20 that allows to load @2x high resolution image: 
 8011059 [macosx] Support automatic @2x images loading on Mac OS X 
  https://bugs.openjdk.java.net/browse/JDK-8011059

The Toolkit.getDefaultToolkit().getImage("image.ext") call silently loads image@2x.ext image (if it exists) and draws it by SunGraphics2D on Retina display.

Is it enough?

Should JDK also provide API that allows to work with loaded high resolution image
(something like NSImage addRepresentation/removeRepresentation/representations in Cocoa)? 

Should it be possible to create/update an image with representations from program? 

Should JDK explicitly provide DPI scale factor like NSScreen backingScaleFactor on Mac OS X or GetDpiForMonitor method on Windows 8.1 [desktop apps only].
Comment 4 lanthale 2014-10-24 22:22:50 UTC
I have tried to use the @2 notation on a netbeans 8.0.1 platform application and have not seen it working. 

For me it would be enough if placing a second file into the same place than the orginal one with @2x.
Comment 5 ebakke 2015-02-21 04:38:51 UTC
As lanthale comments, the "@2x" notation for loading retina-sized icons along with regular-sized ones is now supported in Swing from the JDK side. As an experiment, I tried a couple of different ways of loading the Icon returned from getIcon() in a custom Node displayed in the Projects TopComponent. The Swing method worked, but the ImageUtilities.loadImage approach (preferred and used throughout the NetBeans codebase) did not. Here's what I tried:

-----------
/* This correctly loads the Retina-sized icon "project@2x.png" along with the standard "project.png", and correctly switches between displaying the two when the NetBeans window is dragged between monitors with retina scaling enabled and disabled, respectively. */
Toolkit.getDefaultToolkit().getImage(
  SomeTestNode.class.getClassLoader().getResource("something/project.png"));
ImageUtilities.icon2Image(new javax.swing.ImageIcon(
  SomeTestNode.class.getClassLoader().getResource("something/project.png")));

// This only ever shows "project.png", ignoring "project@2x.png".
ImageUtilities.loadImage("something/project.png", false);
ImageUtilities.loadImage("something/project.png", true);

/*
Product Version: NetBeans IDE 8.0.2 (Build 201411181905)
Java: 1.8.0_31; Java HotSpot(TM) 64-Bit Server VM 25.31-b07
Runtime: Java(TM) SE Runtime Environment 1.8.0_31-b13
*/
-----------

It seems like ImageUtilities.loadImage needs to be updated to include the same kind of logic that was introduced in the patch for JDK-8011059 ( http://hg.openjdk.java.net/jdk8u/jdk8u-dev/jdk/rev/547148daf7af ).
Comment 6 Jiri Prox 2016-01-20 16:07:05 UTC
*** Bug 257374 has been marked as a duplicate of this bug. ***
Comment 7 Alexandr Scherbatiy 2016-01-22 16:42:53 UTC
The JDK-8029339 fix for JDK 9 provides MultiResolutionImage interface which can be used for high-resolution variants loading:
  http://hg.openjdk.java.net/jdk9/client/jdk/rev/7869179af058

java.awt.image.MultiResolutionImage

/**
 * This interface is designed to be an optional additional API supported by
 * some implementations of {@link java.awt.Image} to allow them to provide
 * alternate images for various rendering resolutions. The various
 * {@code Graphics.drawImage(...)} variant methods will consult the methods
 * of this interface if it is implemented on the argument {@code Image} object
 * in order to choose the best representation to use for each rendering operation.
 * <p>
 * The {@code MultiResolutionImage} interface should be implemented by any
 * subclass of {@code java.awt.Image} whose instances are intended to provide
 * image resolution variants according to the given image width and height.
 * For convenience, toolkit images obtained from
 * {@code Toolkit.getImage(String name)} and {@code Toolkit.getImage(URL url)}
 * will implement this interface on platforms that support naming conventions
 * for resolution variants of stored image media and the
 * {@code AbstractMultiResolutionImage} and {@code BaseMultiResolutionImage}
 * classes are provided to facilitate easy construction of custom multi-resolution
 * images from a list of related images.
Comment 8 ebakke 2016-06-10 17:02:42 UTC
Full Retina/HiDPI support in NetBeans probably involves fixing many separate issues, some which involve more work than others.

For instance:
* The ImageUtilities class needs to be updated to support MultiResolutionImage and loading of images with the "@2x" prefix. This will also allow high-resolution icons to be used in Platform applications.
* The NetBean Platform's action registration mechanism should support high-resolution action images.
* Various L&F-related image assets, such as the "X" button in tab panels, need to be recreated at higher resolution.
* The startup splash image needs to be updated to retina resolution, with associated loading code.
* GUI icons must be redrawn at the higher resolution. (Probably unrealistic in the short term unless Oracle or some other sponsor decides to pay to hire an icon designer. No point in trying to draw icons ourselves if the goal is to have professional-looking icons. IntelliJ has already done this, see http://bulenkov.com/wp-content/uploads/2013/06/RetinaImages.png .)
* The inplace variable rename feature in the code editor has some repaint bugs in retina mode.
* The feature that lets you hover over a partially visible file name in the Projects tab to show the entire file name seems to use an offscreen image that is always low-resolution; needs fixing for the Retina case.
* Memory consumption gauge is low-resolution (see kimsp's earlier comment).

I suggest creating separate bugs for each of the above issues, and keeping this bug as an umbrella issue (setting "depends on" to each of the sub-bugs). That way each bug can be tracked and commented-on separately.

Do you guys think we should create a separate bug for each issue?
(Happy to create them.)
Comment 9 Cruiser 2016-10-10 10:45:32 UTC
@ebakke Good idea, I am just a user of netbeans, but hope you have the high dpi support within the Netbeans 9.0 milestone


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