-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathGenIcons.java
More file actions
46 lines (42 loc) · 1.33 KB
/
Copy pathGenIcons.java
File metadata and controls
46 lines (42 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package javaforce.utils;
import java.io.*;
import javaforce.*;
/** Generate icons
*
* @author pquiring
*/
public class GenIcons {
private static int count = 0;
public static void main(String[] args) {
try {
File[] files = new File("src/javaforce/icons/svg").listFiles();
for(File svg : files) {
gen(svg);
}
if (count > 0) {
System.out.println("GenIcons : Generated " + count + " icons.");
}
} catch (Exception e) {
JFLog.log(e);
}
}
private static void gen(File svg) {
String name = svg.getName();
int idx = name.indexOf('.');
String base = name.substring(0, idx);
String i16 = "src/javaforce/icons/16/" + base + ".png";
File f16 = new File(i16);
String i32 = "src/javaforce/icons/32/" + base + ".png";
File f32 = new File(i32);
long svg_date = svg.lastModified();
long i16_date = f16.lastModified();
long i32_date = f32.lastModified();
if (svg_date < i16_date || svg_date < i32_date) return;
String temp = "GenIcons-64.png";
ImageConvert.main(new String[] {svg.getPath(), temp, "size=64,64", "fill=00ffffff", "quiet=true"});
ImageConvert.main(new String[] {temp, i32, "scale=50,50", "quiet=true"});
ImageConvert.main(new String[] {temp, i16, "scale=25,25", "quiet=true"});
new File(temp).delete();
count++;
}
}