JDK-8011059 : [macosx] Support automatic @2x images loading on Mac OS X
  • Type: Task
  • Component: client-libs
  • Sub-Component: demo
  • Affected Version: 7u40,8
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: os_x
  • CPU: generic
  • Submitted: 2013-03-29
  • Updated: 2017-05-24
  • Resolved: 2014-01-30
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8 JDK 9 Other
7u40Fixed 8u20 b01Fixed 9Fixed openjdk7uFixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
This issue is part of the general issue  JDK-7124410 [macosx] Lion HiDPI support 

A user provides high resolution images with @2x modifier.
The Toolkit.getImage(String filename) and Toolkit.getImage(URL url) methods should automatically load the high resolution image and show an image with best fit resolution on HiDPI display (Retina) on Mac OS X.

For example, there are files on disk:
- /dir/image.ext
- /dir/image@2x.ext

Image image = Toolkit.getDefaultToolkit().getImage("/dir/image.ext") //both images (image.ext and image@2x.ext) should be automatically loaded
graphics2d.drawImage(image,..) // The image with necessary resolution should be drawn according to the display transform and scale  
No way to verify.

Release team: Approved for deferral.

8-defer-request: High resolution images support is dropped for HiDPI displays in JDK 8.

If this fix can be completed without a new API then it is not critical for integration now. Please defer to 8u20. - Support for Retina is important but not a release driver - If this could only be done via new API then there might be a case for integrating it now as we otherwise could not add new APIs until JDK 9 - Since this can be done without new APIs it is not a justifiable risk at this time

The fix consists of 2 parts - high resolution images with @2x modifier are automatically loaded by LWCToolkit on Mac OS X - SunGraphics2D.drawImage(Image...) method draws an image with necessary resolution according to the current display scale and transform If no image with @2x modifier is provided the standard logic to draw the base image is used. If image with @2x modifier is provided then an algorithm calculates actual image width and height to be drawn on screen according to the display scale and transform, gets an image with necessary resolution and draw it in the standard way. If an image with @2x modifier contains an error the base image is drawn in the standard way. There should be low risk of this fix because the base algorithms that loads and draws images only takes in account does the ToolkitImage contains image with high resolution or not.

It was decided to not expose new public API for this bug. I have withdrawn the CCC request 8011059 http://ccc.us.oracle.com/8011059 and created the separated issue JDK-8029339 Custom MultiResolution image support on HiDPI displays So no public class fields or methods (RenderingHints) are added.

that was fixed in 7u40, so it becomes P2 from jdk8 pov

NMI: need an assessment of the risk, fix the synopsis to reflect that this is an API change, explain the nature of the code change.

The synopsis of this bug is misleading. It's really about an API change (adding additional constants to RenderingHints), not directly about making the demos look perfect.

SQE: OK to push in jdk8

- webrev link: http://cr.openjdk.java.net/~alexsch/8011059/webrev.14/ - review link: http://mail.openjdk.java.net/pipermail/awt-dev/2013-December/006540.html - JPRT build link: http://bus2001067.us.oracle.com/archives/2013/12/2013-12-05-114309.alex.jdk8-awt/bundles/ - issue impact: Users images will look ugly on HiDPI displays like Retina on Mac OS X - fix rational: Allow to use images with high resolution on HiDPI Displays (Retina on Mac OS X) -risks: Low -suggested testing: run automated tests jdk/test/java/awt/image/MultiResolutionImageTest.java

fix is on review