Skip to content

Commit 7dd6e8f

Browse files
author
Federico Fissore
committed
Windows: proper, non blurry, icon displayed. Fixes #3473
1 parent 1b63cfa commit 7dd6e8f

File tree

3 files changed

+14
-30
lines changed

3 files changed

+14
-30
lines changed

app/src/processing/app/Base.java

+10-11
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
import java.util.logging.Level;
6767
import java.util.logging.Logger;
6868
import java.util.stream.Collectors;
69+
import java.util.stream.Stream;
6970

7071
import static processing.app.I18n.tr;
7172

@@ -1913,22 +1914,20 @@ static public File selectFolder(String prompt, File folder, Component parent) {
19131914

19141915

19151916
/**
1916-
* Give this Frame a Processing icon.
1917+
* Give this Frame an icon.
19171918
*/
19181919
static public void setIcon(Frame frame) {
1919-
// don't use the low-res icon on Mac OS X; the window should
1920-
// already have the right icon from the .app file.
1921-
if (OSUtils.isMacOS()) return;
1922-
1923-
// don't use the low-res icon on Linux
1924-
if (OSUtils.isLinux()){
1925-
Image image = Toolkit.getDefaultToolkit().createImage(BaseNoGui.getContentFile("/lib/arduino.png").getAbsolutePath());
1926-
frame.setIconImage(image);
1920+
if (OSUtils.isMacOS()) {
19271921
return;
19281922
}
19291923

1930-
Image image = Toolkit.getDefaultToolkit().createImage(PApplet.ICON_IMAGE);
1931-
frame.setIconImage(image);
1924+
List<Image> icons = Stream
1925+
.of("16", "24", "32", "48", "64", "72", "96", "128", "256")
1926+
.map(res -> "/lib/icons/" + res + "x" + res + "/apps/arduino.png")
1927+
.map(path -> BaseNoGui.getContentFile(path).getAbsolutePath())
1928+
.map(absPath -> Toolkit.getDefaultToolkit().createImage(absPath))
1929+
.collect(Collectors.toList());
1930+
frame.setIconImages(icons);
19321931
}
19331932

19341933

arduino-core/src/processing/app/legacy/PApplet.java

-19
Original file line numberDiff line numberDiff line change
@@ -65,25 +65,6 @@ public class PApplet {
6565
}
6666
}
6767

68-
/**
69-
* GIF image of the Processing logo.
70-
*/
71-
static public final byte[] ICON_IMAGE = {
72-
71, 73, 70, 56, 57, 97, 16, 0, 16, 0, -60, 0, 0, 0, 0, 0,
73-
0, 0, -127, 0, -127, 0, 0, -127, -127, -127, 0, 0, -127, 0, -127, -127,
74-
-127, 0, -127, -127, -127, -63, -63, -63, 0, 0, -1, 0, -1, 0, 0, -1,
75-
-1, -1, 0, 0, -1, 0, -1, -1, -1, 0, -1, -1, -1, 0, 0, 0,
76-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
77-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
78-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, -7, 4,
79-
9, 0, 0, 16, 0, 44, 0, 0, 0, 0, 16, 0, 16, 0, 0, 5,
80-
75, 32, 36, -118, -57, 96, 14, -57, -88, 66, -27, -23, -90, -86, 43, -97,
81-
99, 59, -65, -30, 125, -77, 3, -14, -4, 8, -109, 15, -120, -22, 61, 78,
82-
15, -124, 15, 25, 28, 28, 93, 63, -45, 115, -22, -116, 90, -83, 82, 89,
83-
-44, -103, 61, 44, -91, -54, -89, 19, -111, 50, 18, -51, -55, 1, 73, -121,
84-
-53, -79, 77, 43, -101, 12, -74, -30, -99, -24, -94, 16, 0, 59,
85-
};
86-
8768
/**
8869
* Split the provided String at wherever whitespace occurs. Multiple
8970
* whitespace (extra spaces or tabs or whatever) between items will count as a

build/build.xml

+4
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,10 @@
791791
<mkdir dir="windows/work" />
792792
<mkdir dir="windows/work/${staging_hardware_folder}" />
793793

794+
<copy todir="windows/work/lib">
795+
<fileset dir="shared" includes="icons/**/*.png"/>
796+
</copy>
797+
794798
<!-- assemble the pde -->
795799
<mkdir dir="windows/work/lib" />
796800
<copy todir="windows/work/lib" flatten="true">

0 commit comments

Comments
 (0)