Added hi-res toolbar images
Hi-resolution images are saved with the "@2x.png" suffix, the image loader will select the best image available based on the user selected scaling. Missing hi-res images can be added later together with lo-res images.
@ -36,12 +36,14 @@ import cc.arduino.packages.DiscoveryManager;
|
||||
import cc.arduino.view.Event;
|
||||
import cc.arduino.view.JMenuUtils;
|
||||
import cc.arduino.view.SplashScreenHelper;
|
||||
|
||||
import org.apache.commons.compress.utils.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import processing.app.debug.TargetBoard;
|
||||
import processing.app.debug.TargetPackage;
|
||||
import processing.app.debug.TargetPlatform;
|
||||
import processing.app.helpers.*;
|
||||
import processing.app.helpers.FileUtils.SplitFile;
|
||||
import processing.app.helpers.filefilters.OnlyDirs;
|
||||
import processing.app.helpers.filefilters.OnlyFilesWithExtension;
|
||||
import processing.app.javax.swing.filechooser.FileNameExtensionFilter;
|
||||
@ -2047,33 +2049,46 @@ public class Base {
|
||||
/**
|
||||
* Return an Image object from inside the Processing lib folder.
|
||||
*/
|
||||
static public Image getLibImage(String name, Component who) {
|
||||
static public Image getLibImage(String filename, Component who) {
|
||||
Toolkit tk = Toolkit.getDefaultToolkit();
|
||||
|
||||
SplitFile name = FileUtils.splitFilename(filename);
|
||||
int scale = Theme.getInteger("gui.scalePercent");
|
||||
// TODO: create high-res enlarged copies and load those if
|
||||
// the scale is more than 125%
|
||||
File imageLocation = new File(getContentFile("lib"), name);
|
||||
Image image = tk.getImage(imageLocation.getAbsolutePath());
|
||||
File libFolder = getContentFile("lib");
|
||||
File imageFile1x = new File(libFolder, name.basename + "." + name.extension);
|
||||
File imageFile2x = new File(libFolder, name.basename + "@2x." + name.extension);
|
||||
|
||||
File imageFile;
|
||||
int sourceScale;
|
||||
if ((scale > 125 && imageFile2x.exists()) || !imageFile1x.exists()) {
|
||||
imageFile = imageFile2x;
|
||||
sourceScale = 200;
|
||||
} else {
|
||||
imageFile = imageFile1x;
|
||||
sourceScale = 100;
|
||||
}
|
||||
|
||||
Image image = tk.getImage(imageFile.getAbsolutePath());
|
||||
MediaTracker tracker = new MediaTracker(who);
|
||||
tracker.addImage(image, 0);
|
||||
try {
|
||||
tracker.waitForAll();
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
if (scale != 100) {
|
||||
int width = image.getWidth(null) * scale / 100;
|
||||
int height = image.getHeight(null) * scale / 100;
|
||||
|
||||
if (scale != sourceScale) {
|
||||
int width = image.getWidth(null) * scale / sourceScale;
|
||||
int height = image.getHeight(null) * scale / sourceScale;
|
||||
image = image.getScaledInstance(width, height, Image.SCALE_SMOOTH);
|
||||
tracker.addImage(image, 1);
|
||||
try {
|
||||
tracker.waitForAll();
|
||||
} catch (InterruptedException e) { }
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
||||
|
||||
// ...................................................................
|
||||
|
||||
|
||||
|
BIN
build/shared/lib/theme/buttons@2x.png
Normal file
After Width: | Height: | Size: 9.4 KiB |
BIN
build/shared/lib/theme/close@2x.png
Normal file
After Width: | Height: | Size: 375 B |
BIN
build/shared/lib/theme/lock@2x.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
build/shared/lib/theme/newwindow@2x.png
Normal file
After Width: | Height: | Size: 382 B |
BIN
build/shared/lib/theme/resize@2x.png
Normal file
After Width: | Height: | Size: 233 B |
BIN
build/shared/lib/theme/tab-sel-left@2x.png
Normal file
After Width: | Height: | Size: 211 B |
BIN
build/shared/lib/theme/tab-sel-menu@2x.png
Normal file
After Width: | Height: | Size: 325 B |
BIN
build/shared/lib/theme/tab-sel-mid@2x.png
Normal file
After Width: | Height: | Size: 169 B |
BIN
build/shared/lib/theme/tab-sel-right@2x.png
Normal file
After Width: | Height: | Size: 223 B |
BIN
build/shared/lib/theme/tab-unsel-left@2x.png
Normal file
After Width: | Height: | Size: 208 B |
BIN
build/shared/lib/theme/tab-unsel-menu@2x.png
Normal file
After Width: | Height: | Size: 328 B |
BIN
build/shared/lib/theme/tab-unsel-mid@2x.png
Normal file
After Width: | Height: | Size: 167 B |
BIN
build/shared/lib/theme/tab-unsel-right@2x.png
Normal file
After Width: | Height: | Size: 222 B |