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

Reply via email to