Skip to content

Commit

Permalink
Use multiResolutionImages
Browse files Browse the repository at this point in the history
  • Loading branch information
RetGal committed Feb 4, 2024
1 parent 5a53efb commit 65bd44b
Show file tree
Hide file tree
Showing 166 changed files with 24 additions and 10 deletions.
7 changes: 3 additions & 4 deletions src/main/java/mpo/dayon/common/gui/common/ImageNames.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ public final class ImageNames {
private ImageNames() {
}

public static final String APP = "app_32.png";
public static final String APP_LARGE = "app_48.png";
public static final String APP = "app.png";
public static final String APP_LARGE = "app_l.png";
public static final String CAPTURE_SETTINGS = "capture_settings.png";
public static final String COMPATIBILITY = "compatibility.png";
public static final String COMPRESSION_SETTINGS = "compression_settings.png";
public static final String CONTROL = "control.png";
public static final String COPY = "copy.png";
public static final String DOWN = "down.png";
public static final String EXIT = "exit.png";
public static final String FINGERPRINT = "fingerprint.png";
Expand All @@ -28,7 +27,7 @@ private ImageNames() {
public static final String START = "start.png";
public static final String STOP = "stop.png";
public static final String UP = "up.png";
public static final String USERS = "users_48.png";
public static final String USERS = "users.png";
public static final String WAITING = "waiting.gif";
public static final String WIN = "win.png";

Expand Down
27 changes: 21 additions & 6 deletions src/main/java/mpo/dayon/common/gui/common/ImageUtilities.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
package mpo.dayon.common.gui.common;

import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import java.util.HashMap;
import java.util.Map;
import java.awt.*;
import java.awt.image.BaseMultiResolutionImage;
import java.io.IOException;
import java.util.*;
import java.util.List;

import static java.lang.String.format;

public final class ImageUtilities {
private ImageUtilities() {
Expand All @@ -13,11 +19,20 @@ private ImageUtilities() {
public static ImageIcon getOrCreateIcon(String name) {
ImageIcon icon = ICON_CACHE.get(name);
if (icon == null) {
final String rname = "/images/" + name;
final String rname = "/images/%s/" + name;
try {
icon = new ImageIcon(ImageUtilities.class.getResource(rname));
} catch (NullPointerException ex) {
throw new IllegalStateException(String.format("Missing icon [%s].", rname));
if (!name.equals("waiting.gif")) {
List<Image> imgList = new ArrayList<>();
for (String s : Arrays.asList("100", "125", "150", "175", "200")) {
imgList.add(ImageIO.read(ImageUtilities.class.getResource(format(rname, s))));
}
BaseMultiResolutionImage multiResolutionImage = new BaseMultiResolutionImage(imgList.toArray(new Image[0]));
icon = new ImageIcon(multiResolutionImage);
} else {
icon = new ImageIcon(ImageUtilities.class.getResource("/images/" + name));
}
} catch (NullPointerException | IOException | IllegalArgumentException ex) {
throw new IllegalStateException(format("Missing icon [%s].", rname));
}
ICON_CACHE.put(name, icon);
}
Expand Down
File renamed without changes
File renamed without changes
Binary file added src/main/resources/images/100/compatibility.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
Binary file added src/main/resources/images/100/down.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/images/100/exit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/images/100/fingerprint.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/images/100/fit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added src/main/resources/images/100/info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/images/100/key.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added src/main/resources/images/100/optimized/app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/images/100/optimized/app_l.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/images/100/optimized/control.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/images/100/optimized/down.png
Binary file added src/main/resources/images/100/optimized/exit.png
Binary file added src/main/resources/images/100/optimized/fit.png
Binary file added src/main/resources/images/100/optimized/help.png
Binary file added src/main/resources/images/100/optimized/info.png
Binary file added src/main/resources/images/100/optimized/key.png
Binary file added src/main/resources/images/100/optimized/settings.png
Binary file added src/main/resources/images/100/optimized/shield.png
File renamed without changes
File renamed without changes
Binary file added src/main/resources/images/100/optimized/up.png
File renamed without changes
Binary file added src/main/resources/images/100/optimized/win.png
Binary file added src/main/resources/images/100/reset_capture.png
Binary file added src/main/resources/images/100/settings.png
Binary file added src/main/resources/images/100/shield.png
Binary file added src/main/resources/images/100/start.png
Binary file added src/main/resources/images/100/stop.png
Binary file added src/main/resources/images/100/up.png
Binary file added src/main/resources/images/100/users.png
Binary file added src/main/resources/images/100/win.png
Binary file added src/main/resources/images/125/app.png
Binary file added src/main/resources/images/125/app_l.png
Binary file added src/main/resources/images/125/capture_settings.png
Binary file added src/main/resources/images/125/compatibility.png
Binary file added src/main/resources/images/125/control.png
Binary file added src/main/resources/images/125/cursor_white.png
Binary file added src/main/resources/images/125/cursor_yellow.png
Binary file added src/main/resources/images/125/down.png
Binary file added src/main/resources/images/125/exit.png
Binary file added src/main/resources/images/125/fingerprint.png
Binary file added src/main/resources/images/125/fit.png
Binary file added src/main/resources/images/125/help.png
Binary file added src/main/resources/images/125/info.png
Binary file added src/main/resources/images/125/key.png
Binary file added src/main/resources/images/125/looknfeel.png
Binary file added src/main/resources/images/125/network_settings.png
Binary file added src/main/resources/images/125/reset_capture.png
Binary file added src/main/resources/images/125/settings.png
Binary file added src/main/resources/images/125/shield.png
Binary file added src/main/resources/images/125/start.png
Binary file added src/main/resources/images/125/stop.png
Binary file added src/main/resources/images/125/up.png
Binary file added src/main/resources/images/125/users.png
Binary file added src/main/resources/images/125/win.png
Binary file added src/main/resources/images/150/app.png
Binary file added src/main/resources/images/150/app_l.png
Binary file added src/main/resources/images/150/capture_settings.png
Binary file added src/main/resources/images/150/compatibility.png
Binary file added src/main/resources/images/150/control.png
Binary file added src/main/resources/images/150/cursor_white.png
Binary file added src/main/resources/images/150/cursor_yellow.png
Binary file added src/main/resources/images/150/down.png
Binary file added src/main/resources/images/150/exit.png
Binary file added src/main/resources/images/150/fingerprint.png
Binary file added src/main/resources/images/150/fit.png
Binary file added src/main/resources/images/150/help.png
Binary file added src/main/resources/images/150/info.png
Binary file added src/main/resources/images/150/key.png
Binary file added src/main/resources/images/150/looknfeel.png
Binary file added src/main/resources/images/150/network_settings.png
Binary file added src/main/resources/images/150/reset_capture.png
Binary file added src/main/resources/images/150/settings.png
Binary file added src/main/resources/images/150/shield.png
Binary file added src/main/resources/images/150/start.png
Binary file added src/main/resources/images/150/stop.png
Binary file added src/main/resources/images/150/up.png
Binary file added src/main/resources/images/150/users.png
Binary file added src/main/resources/images/150/win.png
Binary file added src/main/resources/images/175/app.png
Binary file added src/main/resources/images/175/app_l.png
Binary file added src/main/resources/images/175/capture_settings.png
Binary file added src/main/resources/images/175/compatibility.png
Binary file added src/main/resources/images/175/control.png
Binary file added src/main/resources/images/175/cursor_white.png
Binary file added src/main/resources/images/175/cursor_yellow.png
Binary file added src/main/resources/images/175/down.png
Binary file added src/main/resources/images/175/exit.png
Binary file added src/main/resources/images/175/fingerprint.png
Binary file added src/main/resources/images/175/fit.png
Binary file added src/main/resources/images/175/help.png
Binary file added src/main/resources/images/175/info.png
Binary file added src/main/resources/images/175/key.png
Binary file added src/main/resources/images/175/looknfeel.png
Binary file added src/main/resources/images/175/network_settings.png
Binary file added src/main/resources/images/175/reset_capture.png
Binary file added src/main/resources/images/175/settings.png
Binary file added src/main/resources/images/175/shield.png
Binary file added src/main/resources/images/175/start.png
Binary file added src/main/resources/images/175/stop.png
Binary file added src/main/resources/images/175/up.png
Binary file added src/main/resources/images/175/users.png
Binary file added src/main/resources/images/175/win.png
Binary file added src/main/resources/images/200/app.png
Binary file added src/main/resources/images/200/app_l.png
Binary file added src/main/resources/images/200/capture_settings.png
Binary file added src/main/resources/images/200/compatibility.png
Binary file added src/main/resources/images/200/control.png
Binary file added src/main/resources/images/200/cursor_white.png
Binary file added src/main/resources/images/200/cursor_yellow.png
Binary file added src/main/resources/images/200/down.png
Binary file added src/main/resources/images/200/exit.png
Binary file added src/main/resources/images/200/fingerprint.png
Binary file added src/main/resources/images/200/fit.png
Binary file added src/main/resources/images/200/help.png
Binary file added src/main/resources/images/200/info.png
Binary file added src/main/resources/images/200/key.png
Binary file added src/main/resources/images/200/looknfeel.png
Binary file added src/main/resources/images/200/network_settings.png
Binary file added src/main/resources/images/200/reset_capture.png
Binary file added src/main/resources/images/200/settings.png
Binary file added src/main/resources/images/200/shield.png
Binary file added src/main/resources/images/200/start.png
Binary file added src/main/resources/images/200/stop.png
Binary file added src/main/resources/images/200/up.png
Binary file added src/main/resources/images/200/users.png
Binary file added src/main/resources/images/200/win.png
Binary file removed src/main/resources/images/compatibility.png
Diff not rendered.
Binary file removed src/main/resources/images/compression_settings.png
Diff not rendered.
Binary file removed src/main/resources/images/copy.png
Diff not rendered.
Binary file removed src/main/resources/images/down.png
Diff not rendered.
Binary file removed src/main/resources/images/exit.png
Diff not rendered.
Binary file removed src/main/resources/images/fingerprint.png
Diff not rendered.
Binary file removed src/main/resources/images/fit.png
Diff not rendered.
Binary file removed src/main/resources/images/info.png
Diff not rendered.
Binary file removed src/main/resources/images/key.png
Diff not rendered.
Binary file removed src/main/resources/images/reset_capture.png
Diff not rendered.
Binary file removed src/main/resources/images/settings.png
Diff not rendered.
Binary file removed src/main/resources/images/shield.png
Diff not rendered.
Binary file removed src/main/resources/images/up.png
Diff not rendered.
Binary file removed src/main/resources/images/win.png
Diff not rendered.

0 comments on commit 65bd44b

Please sign in to comment.