-
Notifications
You must be signed in to change notification settings - Fork 863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Donate another batch of SVG icons #8083
base: master
Are you sure you want to change the base?
Conversation
…h the style of other NetBeans icons. The icons for OptionPane are 32x32 pixel version of the info/error/warning/question icons (scaled up from similar 16x16 SVG icons, but maintaining the 1px border width as this looks better). The icons for file chooser are "folder", "file", "parent folder", and "home folder". To keep the SVG loader module optional for NetBeans Platform apps, PNG versions of the icons are used here. SVG versions will be added in a separate commit (together with a bunch of other SVG files).
…on of the effort to make NetBeans look good on HiDPI/Retina screens. There are 99 new icons in total, copied into many more places where duplicate bitmap icons were identified. Some existing icons were also adjusted, and some existing icons were copied into new locations where additional duplicates were identified. I prioritized icons that are commonly seen in the IDE, and which happen to be easy to draw, as well as icons that are similar to already-drawn ones or simple variations or combinations thereof. The changes in this commit consist purely of copying SVG files into various locations in the repo; this was done by the hidpi-icons script at https://github.com/apache/netbeans-tools/tree/master/icon-scripts/hidpi-icons . I will open a separate Pull Request for that repo, to update the Adobe Illustrator file and icon mapping files. The 'icons.html' file that is generated by the hidpi-icons script is now included as part of the commit, in the root of the NetBeans repo. It includes a preamble with useful information and links to the README. See the Pull Request for screenshots.
I wanted to see the icons in comparison and I came up with this ( import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Stream;
public class GenerateComparison {
public static void main(String[] args) throws IOException {
String PATH_TO_NETBEANS = "";
String COMPARE_OUTPUT = "";
Path basePath = Paths.get(PATH_TO_NETBEANS);
try (Stream<Path> pathStream = Files.walk(basePath);
FileOutputStream fos = new FileOutputStream(COMPARE_OUTPUT);
OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8)) {
osw.write(
"""
<html>
<head>
<title></title>
</head>
<body>
<table>
<tr>
<th>Path</th>
<th>SVG</th>
<th>PNG/GIF</th>
</tr>
"""
);
pathStream
.filter(p -> p.getFileName().toString().endsWith(".svg"))
.forEach(svgPath -> {
try {
Path relativePath = basePath.relativize(svgPath);
Path directory = svgPath.getParent();
String svgFilename = svgPath.getFileName().toString();
String pngFilename = svgFilename.replaceAll("\\.svg$", ".png");
String gifFilename = svgFilename.replaceAll("\\.svg$", ".gif");
Path pngPath = directory.resolve(pngFilename);
Path gifPath = directory.resolve(gifFilename);
if (Files.isReadable(pngPath) || Files.isReadable(gifPath)) {
osw.write("<tr>");
osw.write("<td>");
osw.write(relativePath.toString());
osw.write("</td>");
osw.write("<td>");
osw.write("<img src='");
osw.write(svgPath.toUri().toASCIIString());
osw.write("' height='16' width='16' />");
osw.write("</td>");
osw.write("<td>");
if (Files.isReadable(pngPath)) {
osw.write("<img src='");
osw.write(pngPath.toUri().toASCIIString());
osw.write("' height='16' width='16' />");
}
if (Files.isReadable(gifPath)) {
osw.write("<img src='");
osw.write(gifPath.toUri().toASCIIString());
osw.write("' height='16' width='16' />");
}
osw.write("</td>");
osw.write("</tr>");
}
} catch (IOException ex) {
Logger.getLogger(GenerateComparison.class.getName()).log(Level.SEVERE, null, ex);
}
});
osw.write(
"""
</table>
</body>
</html>
"""
);
}
}
} |
Thanks for that; the script works when I tested it! There is also a HTML page summary called "icons.html" in the NetBeans root directory in this PR. There's an online version of the same file at https://people.csail.mit.edu/ebakke/misc/netbeans-icons-241222.html That one is generated by the script in https://github.com/apache/netbeans-tools/tree/master/icon-scripts (Though it's good to have the changes verified with a second script that takes data straight from the source repo only, as opposed to the mappings and hash files used by icon-scripts.) |
Here is another batch of SVG icons for NetBeans, drawn by myself. This is a continuation of the effort to make NetBeans look good on HiDPI/Retina screens (see previous PRs).
There are 99 new icons in total. Many are used in multiple places in the codebase. See this generated page for a visual summary.
Some examples:
Some IDE icons now have SVG icons available, but still load their old PNG versions (e.g. the lightbulb hint icons in the first screenshot above). In these cases we will need to find the place in the codebase where icon loading happens, and change it manually. Automatic loading of SVG versions only happens when icons are loaded via ImageUtilities.loadImage or loadImageIcon, rather than e.g. "new ImageIcon()" or Toolkit.getImage. Such changes are left for future work (contributions welcome!)
There is a corresponding PR to the icon-scripts tool in the netbeans-tools repo, to add the latest version of the original Adobe Illustrator file and update file that specifies the mapping from bitmap to SVG icon files.