[ 
https://issues.apache.org/jira/browse/NETBEANS-1583?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eirik Bakke updated NETBEANS-1583:
----------------------------------
    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|https://docs.oracle.com/javase/10/docs/api/java/awt/image/MultiResolutionImage.html]
 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 "myi...@2x.png" if 
present, returning a MultiResolutionImage (implemented in 
[JDK-8011059|https://bugs.openjdk.java.net/browse/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|https://bugs.openjdk.java.net/browse/JDK-8151787] :

{quote}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.
{quote}
 
On the naming convention, see also 
[JDK-8090575|https://bugs.openjdk.java.net/browse/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|https://bugs.openjdk.java.net/browse/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 some working code 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 org.openide.util.VectorIcon class. Both approaches are valid and should 
be supported by the NetBeans Platform.

  was:
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|https://docs.oracle.com/javase/10/docs/api/java/awt/image/MultiResolutionImage.html]
 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 "myi...@2x.png" if 
present, returning a MultiResolutionImage (implemented in 
[JDK-8011059|https://bugs.openjdk.java.net/browse/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|https://bugs.openjdk.java.net/browse/JDK-8151787] :

{quote}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.
{quote}
 
On the naming convention, see also 
[JDK-8090575|https://bugs.openjdk.java.net/browse/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|https://bugs.openjdk.java.net/browse/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 some working code for createDisabledIcon in particular, 
which works with the VectorIcon class and any other Icon instance.




> Support MultiResolutionImage loading from ImageUtilities 
> ---------------------------------------------------------
>
>                 Key: NETBEANS-1583
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-1583
>             Project: NetBeans
>          Issue Type: Improvement
>          Components: platform - Other
>    Affects Versions: 10.0
>         Environment: Windows, Linux, and MacOS
>            Reporter: Eirik Bakke
>            Priority: Major
>              Labels: HiDPI
>
> 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|https://docs.oracle.com/javase/10/docs/api/java/awt/image/MultiResolutionImage.html]
>  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 "myi...@2x.png" 
> if present, returning a MultiResolutionImage (implemented in 
> [JDK-8011059|https://bugs.openjdk.java.net/browse/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|https://bugs.openjdk.java.net/browse/JDK-8151787] :
> {quote}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.
> {quote}
>  
> On the naming convention, see also 
> [JDK-8090575|https://bugs.openjdk.java.net/browse/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|https://bugs.openjdk.java.net/browse/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 some working code 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 org.openide.util.VectorIcon class. Both approaches are valid and 
> should be supported by the NetBeans Platform.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to