From 7dd6e8f57dd7c4a2a8a59b32569759b4fad04c7b Mon Sep 17 00:00:00 2001 From: Federico Fissore Date: Tue, 24 Nov 2015 09:52:31 +0100 Subject: [PATCH] Windows: proper, non blurry, icon displayed. Fixes #3473 --- app/src/processing/app/Base.java | 21 +++++++++---------- .../src/processing/app/legacy/PApplet.java | 19 ----------------- build/build.xml | 4 ++++ 3 files changed, 14 insertions(+), 30 deletions(-) diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index eb3f9cf97..fd334a845 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -66,6 +66,7 @@ import java.util.logging.Handler; import java.util.logging.Level; import java.util.logging.Logger; import java.util.stream.Collectors; +import java.util.stream.Stream; import static processing.app.I18n.tr; @@ -1913,22 +1914,20 @@ public class Base { /** - * Give this Frame a Processing icon. + * Give this Frame an icon. */ static public void setIcon(Frame frame) { - // don't use the low-res icon on Mac OS X; the window should - // already have the right icon from the .app file. - if (OSUtils.isMacOS()) return; - - // don't use the low-res icon on Linux - if (OSUtils.isLinux()){ - Image image = Toolkit.getDefaultToolkit().createImage(BaseNoGui.getContentFile("/lib/arduino.png").getAbsolutePath()); - frame.setIconImage(image); + if (OSUtils.isMacOS()) { return; } - Image image = Toolkit.getDefaultToolkit().createImage(PApplet.ICON_IMAGE); - frame.setIconImage(image); + List icons = Stream + .of("16", "24", "32", "48", "64", "72", "96", "128", "256") + .map(res -> "/lib/icons/" + res + "x" + res + "/apps/arduino.png") + .map(path -> BaseNoGui.getContentFile(path).getAbsolutePath()) + .map(absPath -> Toolkit.getDefaultToolkit().createImage(absPath)) + .collect(Collectors.toList()); + frame.setIconImages(icons); } diff --git a/arduino-core/src/processing/app/legacy/PApplet.java b/arduino-core/src/processing/app/legacy/PApplet.java index 2a9abc56e..87c0fb477 100644 --- a/arduino-core/src/processing/app/legacy/PApplet.java +++ b/arduino-core/src/processing/app/legacy/PApplet.java @@ -65,25 +65,6 @@ public class PApplet { } } - /** - * GIF image of the Processing logo. - */ - static public final byte[] ICON_IMAGE = { - 71, 73, 70, 56, 57, 97, 16, 0, 16, 0, -60, 0, 0, 0, 0, 0, - 0, 0, -127, 0, -127, 0, 0, -127, -127, -127, 0, 0, -127, 0, -127, -127, - -127, 0, -127, -127, -127, -63, -63, -63, 0, 0, -1, 0, -1, 0, 0, -1, - -1, -1, 0, 0, -1, 0, -1, -1, -1, 0, -1, -1, -1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, -7, 4, - 9, 0, 0, 16, 0, 44, 0, 0, 0, 0, 16, 0, 16, 0, 0, 5, - 75, 32, 36, -118, -57, 96, 14, -57, -88, 66, -27, -23, -90, -86, 43, -97, - 99, 59, -65, -30, 125, -77, 3, -14, -4, 8, -109, 15, -120, -22, 61, 78, - 15, -124, 15, 25, 28, 28, 93, 63, -45, 115, -22, -116, 90, -83, 82, 89, - -44, -103, 61, 44, -91, -54, -89, 19, -111, 50, 18, -51, -55, 1, 73, -121, - -53, -79, 77, 43, -101, 12, -74, -30, -99, -24, -94, 16, 0, 59, - }; - /** * Split the provided String at wherever whitespace occurs. Multiple * whitespace (extra spaces or tabs or whatever) between items will count as a diff --git a/build/build.xml b/build/build.xml index 14714c26a..e21d45d27 100644 --- a/build/build.xml +++ b/build/build.xml @@ -791,6 +791,10 @@ + + + +