I continue to change -J-Dsun.java2d.dpiaware=true to false to have NetBeans 
appear properly and respect Microsoft scaling on a Hi DPI display. Having 
everything scalable regardless of the display is a worthwhile goal. The same 
for having control of the font size for everything, not just the editor and 
output windows.


-----Original Message-----
From: Christian Lenz <christian.l...@gmx.net> 
Sent: September 12, 2018 2:53 AM
To: dev@netbeans.incubator.apache.org
Subject: AW: dpi on Windows Java 9

Great, thx 😊


Von: Eirik Bakke
Gesendet: Mittwoch, 12. September 2018 00:42
An: dev@netbeans.incubator.apache.org
Betreff: RE: dpi on Windows Java 9

I've submitted a pull request that adds scalable icons for the most important 
window system icons, that is those in o.n.swing.tabcontrol and openide.awt, 
starting with the Windows L&F (plus a couple of platform-independent icons):

https://github.com/apache/incubator-netbeans/pull/859

LAF icons, in particular, are often both simple and highly parameterized (need 
both enabled, disabled, rollover, and pressed variants, and might eventually 
need Darcula versions), and so made sense to implement with custom painting 
code. This is the approach taken in Swing's own Windows L&F, e.g. for checkbox 
checks and combobox dropdown arrows [1]. On Windows, in particular, arbitrary 
DPI scalings can be encountered, so the Mac approach of just serving an extra 
bitmap "@2x" resolution for each icon does not work in all cases.

(For other kinds of icons, there's still a need to let ImageUtilities load 
bitmaps with multiple resolutions available. Automatic SVG loading & rendering, 
like Tim Boudreau suggested, would be another great feature.)
 
-- Eirik
[1] See 
http://hg.openjdk.java.net/jdk10/jdk10/jdk/file/tip/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java

-----Original Message-----
From: Tim Boudreau <niftin...@gmail.com>
Sent: Sunday, March 11, 2018 5:14 PM
To: dev@netbeans.incubator.apache.org; Emilian Bold <emilian.b...@protonmail.ch>
Subject: Re: dpi on Windows Java 9

IMO, if we wanted to do this and be future-proof, the thing to do would be to 
convert the icons to SVG or some similar vector format and update the icon 
loading code in ImageUtilities to use it.

There are some tools - particularly potrace - that can assist in initial 
conversion, but deal in tracing lines and shapes and give 2- or 3- color output 
(potrace lets you set a single interior color for closed shapes), but which 
could be helpful as a start.

Given that SVG is XML-based, I could imagine that just using something like 
Batik to load SVG would be unacceptable;  but SVG could be used as a 
designer-friendly input stage, and then be compiled by the build process into 
something more performant (either literal Java code that paints the contents of 
the svg, or some binary representation of drawing instructions), much the same 
way resource bundle message annotations are turned into static methods.

I've written code before that implements a Graphics2D that simply stores a list 
of everything it was told to do - wouldn't be that hard to take the list of 
drawing instructions from there and generate Java code to reproduce those steps.

Straw man example:

 - Code that uses an SVG icon is annotated with
@Icon("org/netbeans/modules/x/myIcon.svg")
 - At build time:
   - Annotation processor looks up that file, reads it with Batik, paints it 
into a code-generating Graphics2D which outputs a generated static method 
myIcon() on a generated class in the same package
   - Code that wants to use the icon calls the static method, the same way 
bundle messages are loaded in modern NetBeans code
 - At run time:
   - If using the generated static method, the output is just an image or an 
icon, no surprises
   - For the case where icons are shared across modules (this happens), 
ImageUtilities could be tweaked to, in the case of a .svg extension, try to 
look up the generated class / method (and optionally fall back to Batik if 
nobody minded a dependency on it, but that could be pluggable via Lookup if 
it's even needed)

The hard part is converting to SVG, since turning an image into efficient 
vectors is a genuinely hard problem where there are many non-optimal answers 
and few optimal ones - particularly for converting gradients.  I could imagine 
getting a little better output by running the icon through potrace with several 
color filters on it and combining the output.  But likely it simply requires a 
bunch of manual tweaking.

-Tim


On Sun, Mar 11, 2018 at 4:07 PM, Emilian Bold <emilian.b...@protonmail.ch>
wrote:

> > In my opinion, the correct fix would be for applications to provide 
> > higher resolution icons :) It's a win-win for everyone.
>
> https://nextbeans.com/retina
> https://jaxenter.com/netbeans/netbeans-retina
>
> --emi
>
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
>
> On 11 March 2018 9:49 PM, cowwoc <cow...@bbs.darktech.org> wrote:
>
> > I might be in the minority, but I actually prefer the new look. It 
> > makes
> >
> > Netbeans a lot easier to use in high DPI environments (yes, on Windows).
> >
> > Netbeans with JDK 8 looks super tiny.
> >
> > In my opinion, the correct fix would be for applications to provide
> >
> > higher resolution icons :) It's a win-win for everyone.
> >
> > Gili
> >
> > On 2018-03-11 3:14 PM, Neil C Smith wrote:
> >
> > > Hi,
> > >
> > > On Sun, 11 Mar 2018, 19:02 , toni.ep...@eppleton.de wrote:
> > >
> > > > It's a 13,3" FHD 1920 x 1080 with app scaling set to 150%. Not 
> > > > sure
> if
> > > >
> > > > that already counts as high dpi.
> > >
> > > Looks like you're not alone anyway
> > >
> > > https://bugs.openjdk.java.net/browse/JDK-8187367
> > >
> > > Not sure if there's a workaround amongst that lot!
> > >
> > > Best wishes,
> > >
> > > Neil
> > >
> > > > --
> > > >
> > > > Neil C Smith
> > > >
> > > > Artist & Technologist
> > > >
> > > > www.neilcsmith.net
> > >
> > > Praxis LIVE - hybrid visual IDE for creative coding -
> www.praxislive.org
> >
> > --
> >
> > To unsubscribe, e-mail: 
> > dev-unsubscr...@netbeans.incubator.apache.org
> >
> > For additional commands, e-mail: 
> > dev-h...@netbeans.incubator.apache.org
> >
> > For further information about the NetBeans mailing lists, visit:
> >
> > https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@netbeans.incubator.apache.org
> For additional commands, e-mail: 
> dev-h...@netbeans.incubator.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>
>
>


--
http://timboudreau.com
B KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCB  [  
X  ܚX KK[XZ[
 ] ][  X  ܚX P ] X[ ˚[  X ]܋ \X K ܙ B  ܈Y][ۘ[  [X[  K[XZ[
 ] Z[ ] X[ ˚[  X ]܋ \X K ܙ B B  ܈ \ \ [  ܛX][ۈX  ]H ] X[  
XZ[[  \   \ ]
 B ΋    Z K \X K ܙ   ۙ Y[  K \ ^KӑU PS   XZ[[   \  B B B


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

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


Reply via email to