ImageUtil: Add getResourceStreamFromClass method
This replaces invocations of `Class.getResourceAsStream(path)` in order to relieve plugin/client code from managing synchronization and handling exceptions.
This commit is contained in:
@@ -25,11 +25,10 @@
|
|||||||
package net.runelite.client.game;
|
package net.runelite.client.game;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.api.Skill;
|
import net.runelite.api.Skill;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -48,21 +47,11 @@ public class SkillIconManager
|
|||||||
return imgCache[skillIdx];
|
return imgCache[skillIdx];
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
String skillIconPath = (small ? "/skill_icons_small/" : "/skill_icons/")
|
||||||
{
|
+ skill.getName().toLowerCase() + ".png";
|
||||||
String skillIconPath = (small ? "/skill_icons_small/" : "/skill_icons/")
|
log.debug("Loading skill icon from {}", skillIconPath);
|
||||||
+ skill.getName().toLowerCase() + ".png";
|
skillImage = ImageUtil.getResourceStreamFromClass(getClass(), skillIconPath);
|
||||||
log.debug("Loading skill icon from {}", skillIconPath);
|
imgCache[skillIdx] = skillImage;
|
||||||
synchronized (ImageIO.class)
|
|
||||||
{
|
|
||||||
skillImage = ImageIO.read(SkillIconManager.class.getResourceAsStream(skillIconPath));
|
|
||||||
}
|
|
||||||
imgCache[skillIdx] = skillImage;
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
log.debug("Error Loading skill icons {}", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return skillImage;
|
return skillImage;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,9 +26,7 @@ package net.runelite.client.plugins.account;
|
|||||||
|
|
||||||
import com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -40,6 +38,7 @@ import net.runelite.client.plugins.Plugin;
|
|||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
import net.runelite.client.ui.ClientToolbar;
|
import net.runelite.client.ui.ClientToolbar;
|
||||||
import net.runelite.client.ui.NavigationButton;
|
import net.runelite.client.ui.NavigationButton;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
import net.runelite.client.util.RunnableExceptionLogger;
|
import net.runelite.client.util.RunnableExceptionLogger;
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
@@ -67,18 +66,8 @@ public class AccountPlugin extends Plugin
|
|||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
try
|
LOGIN_IMAGE = ImageUtil.getResourceStreamFromClass(AccountPlugin.class, "login_icon.png");
|
||||||
{
|
LOGOUT_IMAGE = ImageUtil.getResourceStreamFromClass(AccountPlugin.class, "logout_icon.png");
|
||||||
synchronized (ImageIO.class)
|
|
||||||
{
|
|
||||||
LOGIN_IMAGE = ImageIO.read(AccountPlugin.class.getResourceAsStream("login_icon.png"));
|
|
||||||
LOGOUT_IMAGE = ImageIO.read(AccountPlugin.class.getResourceAsStream("logout_icon.png"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import java.awt.Font;
|
|||||||
import java.awt.Image;
|
import java.awt.Image;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import net.runelite.api.ChatMessageType;
|
import net.runelite.api.ChatMessageType;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
@@ -46,6 +45,7 @@ import net.runelite.client.plugins.Plugin;
|
|||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
import net.runelite.client.ui.FontManager;
|
import net.runelite.client.ui.FontManager;
|
||||||
import net.runelite.client.ui.overlay.OverlayManager;
|
import net.runelite.client.ui.overlay.OverlayManager;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Barbarian Assault",
|
name = "Barbarian Assault",
|
||||||
@@ -87,10 +87,7 @@ public class BarbarianAssaultPlugin extends Plugin
|
|||||||
font = FontManager.getRunescapeFont()
|
font = FontManager.getRunescapeFont()
|
||||||
.deriveFont(Font.BOLD, 24);
|
.deriveFont(Font.BOLD, 24);
|
||||||
|
|
||||||
synchronized (ImageIO.class)
|
clockImage = ImageUtil.getResourceStreamFromClass(getClass(), "clock.png");
|
||||||
{
|
|
||||||
clockImage = ImageIO.read(getClass().getResourceAsStream("clock.png"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import com.google.inject.Provides;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@@ -49,6 +48,7 @@ import net.runelite.client.plugins.Plugin;
|
|||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
import net.runelite.client.ui.overlay.OverlayManager;
|
import net.runelite.client.ui.overlay.OverlayManager;
|
||||||
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Boosts Information",
|
name = "Boosts Information",
|
||||||
@@ -118,11 +118,8 @@ public class BoostsPlugin extends Plugin
|
|||||||
Arrays.fill(lastSkillLevels, -1);
|
Arrays.fill(lastSkillLevels, -1);
|
||||||
|
|
||||||
// Add infoboxes for everything at startup and then determine inside if it will be rendered
|
// Add infoboxes for everything at startup and then determine inside if it will be rendered
|
||||||
synchronized (ImageIO.class)
|
infoBoxManager.addInfoBox(new StatChangeIndicator(true, ImageUtil.getResourceStreamFromClass(getClass(), "debuffed.png"), this, config));
|
||||||
{
|
infoBoxManager.addInfoBox(new StatChangeIndicator(false, ImageUtil.getResourceStreamFromClass(getClass(), "buffed.png"), this, config));
|
||||||
infoBoxManager.addInfoBox(new StatChangeIndicator(true, ImageIO.read(getClass().getResourceAsStream("debuffed.png")), this, config));
|
|
||||||
infoBoxManager.addInfoBox(new StatChangeIndicator(false, ImageIO.read(getClass().getResourceAsStream("buffed.png")), this, config));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (final Skill skill : Skill.values())
|
for (final Skill skill : Skill.values())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,13 +29,11 @@ package net.runelite.client.plugins.cluescrolls;
|
|||||||
import com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -84,6 +82,7 @@ import net.runelite.client.plugins.cluescrolls.clues.ObjectClueScroll;
|
|||||||
import net.runelite.client.plugins.cluescrolls.clues.TextClueScroll;
|
import net.runelite.client.plugins.cluescrolls.clues.TextClueScroll;
|
||||||
import net.runelite.client.ui.overlay.OverlayManager;
|
import net.runelite.client.ui.overlay.OverlayManager;
|
||||||
import net.runelite.client.ui.overlay.worldmap.WorldMapPointManager;
|
import net.runelite.client.ui.overlay.worldmap.WorldMapPointManager;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
import net.runelite.client.util.QueryRunner;
|
import net.runelite.client.util.QueryRunner;
|
||||||
import net.runelite.client.util.Text;
|
import net.runelite.client.util.Text;
|
||||||
|
|
||||||
@@ -403,17 +402,7 @@ public class ClueScrollPlugin extends Plugin
|
|||||||
return emoteImage;
|
return emoteImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
emoteImage = ImageUtil.getResourceStreamFromClass(getClass(), "emote.png");
|
||||||
{
|
|
||||||
synchronized (ImageIO.class)
|
|
||||||
{
|
|
||||||
emoteImage = ImageIO.read(getClass().getResourceAsStream("emote.png"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return emoteImage;
|
return emoteImage;
|
||||||
}
|
}
|
||||||
@@ -430,17 +419,7 @@ public class ClueScrollPlugin extends Plugin
|
|||||||
return mapArrow;
|
return mapArrow;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
mapArrow = ImageUtil.getResourceStreamFromClass(getClass(), "/util/clue_arrow.png");
|
||||||
{
|
|
||||||
synchronized (ImageIO.class)
|
|
||||||
{
|
|
||||||
mapArrow = ImageIO.read(getClass().getResourceAsStream("/util/clue_arrow.png"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return mapArrow;
|
return mapArrow;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,14 +38,12 @@ import java.awt.event.MouseEvent;
|
|||||||
import java.awt.event.WindowAdapter;
|
import java.awt.event.WindowAdapter;
|
||||||
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowEvent;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
@@ -124,20 +122,10 @@ public class ConfigPanel extends PluginPanel
|
|||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
try
|
final BufferedImage backIcon = ImageUtil.getResourceStreamFromClass(ConfigPanel.class, "config_back_icon.png");
|
||||||
{
|
BACK_ICON = new ImageIcon(backIcon);
|
||||||
synchronized (ImageIO.class)
|
BACK_ICON_HOVER = new ImageIcon(ImageUtil.alphaOffset(backIcon, -100));
|
||||||
{
|
SEARCH = new ImageIcon(ImageUtil.getResourceStreamFromClass(IconTextField.class, "search.png"));
|
||||||
BufferedImage backIcon = ImageIO.read(ConfigPanel.class.getResourceAsStream("config_back_icon.png"));
|
|
||||||
BACK_ICON = new ImageIcon(backIcon);
|
|
||||||
BACK_ICON_HOVER = new ImageIcon(ImageUtil.alphaOffset(backIcon, -100));
|
|
||||||
SEARCH = new ImageIcon(ImageIO.read(IconTextField.class.getResourceAsStream("search.png")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigPanel(PluginManager pluginManager, ConfigManager configManager, ScheduledExecutorService executorService,
|
ConfigPanel(PluginManager pluginManager, ConfigManager configManager, ScheduledExecutorService executorService,
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ package net.runelite.client.plugins.config;
|
|||||||
import com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import net.runelite.client.config.ChatColorConfig;
|
import net.runelite.client.config.ChatColorConfig;
|
||||||
@@ -39,6 +38,7 @@ import net.runelite.client.plugins.PluginDescriptor;
|
|||||||
import net.runelite.client.plugins.PluginManager;
|
import net.runelite.client.plugins.PluginManager;
|
||||||
import net.runelite.client.ui.NavigationButton;
|
import net.runelite.client.ui.NavigationButton;
|
||||||
import net.runelite.client.ui.ClientToolbar;
|
import net.runelite.client.ui.ClientToolbar;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Configuration",
|
name = "Configuration",
|
||||||
@@ -73,11 +73,7 @@ public class ConfigPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
configPanel = new ConfigPanel(pluginManager, configManager, executorService, runeLiteConfig, chatColorConfig);
|
configPanel = new ConfigPanel(pluginManager, configManager, executorService, runeLiteConfig, chatColorConfig);
|
||||||
|
|
||||||
BufferedImage icon;
|
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "config_icon.png");
|
||||||
synchronized (ImageIO.class)
|
|
||||||
{
|
|
||||||
icon = ImageIO.read(getClass().getResourceAsStream("config_icon.png"));
|
|
||||||
}
|
|
||||||
|
|
||||||
navButton = NavigationButton.builder()
|
navButton = NavigationButton.builder()
|
||||||
.tooltip("Configuration")
|
.tooltip("Configuration")
|
||||||
|
|||||||
@@ -29,12 +29,10 @@ import java.awt.Color;
|
|||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.GridLayout;
|
import java.awt.GridLayout;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
@@ -84,34 +82,27 @@ class PluginListItem extends JPanel
|
|||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
try
|
BufferedImage configIcon = ImageUtil.getResourceStreamFromClass(ConfigPanel.class, "config_edit_icon.png");
|
||||||
{
|
BufferedImage onSwitcher = ImageUtil.getResourceStreamFromClass(ConfigPanel.class, "switcher_on.png");
|
||||||
BufferedImage configIcon;
|
BufferedImage onStar = ImageUtil.getResourceStreamFromClass(ConfigPanel.class, "star_on.png");
|
||||||
|
CONFIG_ICON = new ImageIcon(configIcon);
|
||||||
synchronized (ImageIO.class)
|
ON_SWITCHER = new ImageIcon(onSwitcher);
|
||||||
{
|
ON_STAR = new ImageIcon(onStar);
|
||||||
configIcon = ImageIO.read(ConfigPanel.class.getResourceAsStream("config_edit_icon.png"));
|
CONFIG_ICON_HOVER = new ImageIcon(ImageUtil.grayscaleOffset(configIcon, -100));
|
||||||
CONFIG_ICON = new ImageIcon(configIcon);
|
BufferedImage offSwitcherImage = ImageUtil.flipImage(
|
||||||
ON_SWITCHER = new ImageIcon(ImageIO.read(ConfigPanel.class.getResourceAsStream("switcher_on.png")));
|
ImageUtil.grayscaleOffset(
|
||||||
ON_STAR = new ImageIcon(ImageIO.read(ConfigPanel.class.getResourceAsStream("star_on.png")));
|
ImageUtil.grayscaleImage(onSwitcher),
|
||||||
}
|
0.61f
|
||||||
|
),
|
||||||
BufferedImage offSwitcherImage = ImageUtil.bufferedImageFromImage(ON_SWITCHER.getImage());
|
true,
|
||||||
offSwitcherImage = ImageUtil.grayscaleImage(offSwitcherImage);
|
false
|
||||||
offSwitcherImage = ImageUtil.grayscaleOffset(offSwitcherImage, 0.61f);
|
);
|
||||||
offSwitcherImage = ImageUtil.flipImage(offSwitcherImage, true, false);
|
OFF_SWITCHER = new ImageIcon(offSwitcherImage);
|
||||||
OFF_SWITCHER = new ImageIcon(offSwitcherImage);
|
BufferedImage offStar = ImageUtil.grayscaleOffset(
|
||||||
BufferedImage offStarImage = ImageUtil.bufferedImageFromImage(ON_STAR.getImage());
|
ImageUtil.grayscaleImage(onStar),
|
||||||
offStarImage = ImageUtil.grayscaleImage(offStarImage);
|
0.77f
|
||||||
offStarImage = ImageUtil.grayscaleOffset(offStarImage, 0.77f);
|
);
|
||||||
OFF_STAR = new ImageIcon(offStarImage);
|
OFF_STAR = new ImageIcon(offStar);
|
||||||
|
|
||||||
CONFIG_ICON_HOVER = new ImageIcon(ImageUtil.alphaOffset(configIcon, -100));
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -28,12 +28,10 @@ import com.google.common.collect.ImmutableSet;
|
|||||||
import com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import static net.runelite.api.AnimationID.DEATH;
|
import static net.runelite.api.AnimationID.DEATH;
|
||||||
@@ -53,6 +51,7 @@ import net.runelite.client.plugins.PluginDescriptor;
|
|||||||
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||||
import net.runelite.client.ui.overlay.infobox.Timer;
|
import net.runelite.client.ui.overlay.infobox.Timer;
|
||||||
import net.runelite.client.ui.overlay.worldmap.WorldMapPointManager;
|
import net.runelite.client.ui.overlay.worldmap.WorldMapPointManager;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Death Indicator",
|
name = "Death Indicator",
|
||||||
@@ -333,17 +332,7 @@ public class DeathIndicatorPlugin extends Plugin
|
|||||||
return mapArrow;
|
return mapArrow;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
mapArrow = ImageUtil.getResourceStreamFromClass(getClass(), "/util/clue_arrow.png");
|
||||||
{
|
|
||||||
synchronized (ImageIO.class)
|
|
||||||
{
|
|
||||||
mapArrow = ImageIO.read(getClass().getResourceAsStream("/util/clue_arrow.png"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return mapArrow;
|
return mapArrow;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ import com.google.inject.Provides;
|
|||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import static java.lang.Math.min;
|
import static java.lang.Math.min;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.api.ChatMessageType;
|
import net.runelite.api.ChatMessageType;
|
||||||
@@ -51,6 +50,7 @@ import net.runelite.client.ui.FontManager;
|
|||||||
import net.runelite.client.ui.NavigationButton;
|
import net.runelite.client.ui.NavigationButton;
|
||||||
import net.runelite.client.ui.ClientToolbar;
|
import net.runelite.client.ui.ClientToolbar;
|
||||||
import net.runelite.client.ui.overlay.OverlayManager;
|
import net.runelite.client.ui.overlay.OverlayManager;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
@@ -130,11 +130,7 @@ public class DevToolsPlugin extends Plugin
|
|||||||
|
|
||||||
final DevToolsPanel panel = injector.getInstance(DevToolsPanel.class);
|
final DevToolsPanel panel = injector.getInstance(DevToolsPanel.class);
|
||||||
|
|
||||||
BufferedImage icon;
|
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "devtools_icon.png");
|
||||||
synchronized (ImageIO.class)
|
|
||||||
{
|
|
||||||
icon = ImageIO.read(getClass().getResourceAsStream("devtools_icon.png"));
|
|
||||||
}
|
|
||||||
|
|
||||||
navButton = NavigationButton.builder()
|
navButton = NavigationButton.builder()
|
||||||
.tooltip("Developer Tools")
|
.tooltip("Developer Tools")
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ import java.time.temporal.ChronoUnit;
|
|||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import static net.runelite.api.Constants.CHUNK_SIZE;
|
import static net.runelite.api.Constants.CHUNK_SIZE;
|
||||||
import net.runelite.api.GameState;
|
import net.runelite.api.GameState;
|
||||||
@@ -51,6 +50,7 @@ import net.runelite.client.plugins.PluginDescriptor;
|
|||||||
import net.runelite.client.task.Schedule;
|
import net.runelite.client.task.Schedule;
|
||||||
import net.runelite.client.ui.ClientToolbar;
|
import net.runelite.client.ui.ClientToolbar;
|
||||||
import net.runelite.client.ui.NavigationButton;
|
import net.runelite.client.ui.NavigationButton;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
import net.runelite.client.util.LinkBrowser;
|
import net.runelite.client.util.LinkBrowser;
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
@@ -88,11 +88,7 @@ public class DiscordPlugin extends Plugin
|
|||||||
@Override
|
@Override
|
||||||
protected void startUp() throws Exception
|
protected void startUp() throws Exception
|
||||||
{
|
{
|
||||||
BufferedImage icon;
|
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "discord.png");
|
||||||
synchronized (ImageIO.class)
|
|
||||||
{
|
|
||||||
icon = ImageIO.read(getClass().getResourceAsStream("discord.png"));
|
|
||||||
}
|
|
||||||
|
|
||||||
discordButton = NavigationButton.builder()
|
discordButton = NavigationButton.builder()
|
||||||
.tab(false)
|
.tab(false)
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import com.google.inject.Provides;
|
|||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -46,6 +45,7 @@ import net.runelite.client.plugins.PluginDescriptor;
|
|||||||
import net.runelite.client.task.Schedule;
|
import net.runelite.client.task.Schedule;
|
||||||
import net.runelite.client.ui.NavigationButton;
|
import net.runelite.client.ui.NavigationButton;
|
||||||
import net.runelite.client.ui.ClientToolbar;
|
import net.runelite.client.ui.ClientToolbar;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Farming Tracker",
|
name = "Farming Tracker",
|
||||||
@@ -88,11 +88,7 @@ public class FarmingTrackerPlugin extends Plugin
|
|||||||
@Override
|
@Override
|
||||||
protected void startUp() throws Exception
|
protected void startUp() throws Exception
|
||||||
{
|
{
|
||||||
BufferedImage icon;
|
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "farming.png");
|
||||||
synchronized (ImageIO.class)
|
|
||||||
{
|
|
||||||
icon = ImageIO.read(getClass().getResourceAsStream("farming.png"));
|
|
||||||
}
|
|
||||||
|
|
||||||
panel = new FarmingTrackerPanel(client, itemManager, configManager, config, farmingWorld);
|
panel = new FarmingTrackerPanel(client, itemManager, configManager, config, farmingWorld);
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import net.runelite.client.ui.ColorScheme;
|
import net.runelite.client.ui.ColorScheme;
|
||||||
import net.runelite.client.ui.FontManager;
|
import net.runelite.client.ui.FontManager;
|
||||||
import net.runelite.client.ui.PluginPanel;
|
import net.runelite.client.ui.PluginPanel;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
import net.runelite.client.util.LinkBrowser;
|
import net.runelite.client.util.LinkBrowser;
|
||||||
import net.runelite.http.api.RuneLiteAPI;
|
import net.runelite.http.api.RuneLiteAPI;
|
||||||
import net.runelite.http.api.feed.FeedItem;
|
import net.runelite.http.api.feed.FeedItem;
|
||||||
@@ -102,18 +103,8 @@ class FeedPanel extends PluginPanel
|
|||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
try
|
RUNELITE_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(FeedPanel.class, "runelite.png"));
|
||||||
{
|
OSRS_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(FeedPanel.class, "osrs.png"));
|
||||||
synchronized (ImageIO.class)
|
|
||||||
{
|
|
||||||
RUNELITE_ICON = new ImageIcon(ImageIO.read(FeedPanel.class.getResourceAsStream("runelite.png")));
|
|
||||||
OSRS_ICON = new ImageIcon(ImageIO.read(FeedPanel.class.getResourceAsStream("osrs.png")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final FeedConfig config;
|
private final FeedConfig config;
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ import java.time.temporal.ChronoUnit;
|
|||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.api.events.ConfigChanged;
|
import net.runelite.api.events.ConfigChanged;
|
||||||
@@ -43,6 +42,7 @@ import net.runelite.client.plugins.PluginDescriptor;
|
|||||||
import net.runelite.client.task.Schedule;
|
import net.runelite.client.task.Schedule;
|
||||||
import net.runelite.client.ui.NavigationButton;
|
import net.runelite.client.ui.NavigationButton;
|
||||||
import net.runelite.client.ui.ClientToolbar;
|
import net.runelite.client.ui.ClientToolbar;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
import net.runelite.http.api.feed.FeedClient;
|
import net.runelite.http.api.feed.FeedClient;
|
||||||
import net.runelite.http.api.feed.FeedResult;
|
import net.runelite.http.api.feed.FeedResult;
|
||||||
|
|
||||||
@@ -86,11 +86,7 @@ public class FeedPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
feedPanel = new FeedPanel(config, feedSupplier);
|
feedPanel = new FeedPanel(config, feedSupplier);
|
||||||
|
|
||||||
BufferedImage icon;
|
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "icon.png");
|
||||||
synchronized (ImageIO.class)
|
|
||||||
{
|
|
||||||
icon = ImageIO.read(getClass().getResourceAsStream("icon.png"));
|
|
||||||
}
|
|
||||||
|
|
||||||
navButton = NavigationButton.builder()
|
navButton = NavigationButton.builder()
|
||||||
.tooltip("News Feed")
|
.tooltip("News Feed")
|
||||||
|
|||||||
@@ -36,9 +36,7 @@ import java.awt.event.MouseAdapter;
|
|||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.awt.event.MouseListener;
|
import java.awt.event.MouseListener;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
@@ -84,18 +82,9 @@ public class GrandExchangeOfferSlot extends JPanel
|
|||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
try
|
final BufferedImage rightArrow = ImageUtil.alphaOffset(ImageUtil.getResourceStreamFromClass(GrandExchangeOfferSlot.class, "/util/arrow_right.png"), 0.25f);
|
||||||
{
|
RIGHT_ARROW_ICON = new ImageIcon(rightArrow);
|
||||||
synchronized (ImageIO.class)
|
LEFT_ARROW_ICON = new ImageIcon(ImageUtil.flipImage(rightArrow, true, false));
|
||||||
{
|
|
||||||
RIGHT_ARROW_ICON = new ImageIcon(ImageUtil.alphaOffset(ImageIO.read(GrandExchangeOfferSlot.class.getResourceAsStream("/util/arrow_right.png")), 0.25f));
|
|
||||||
LEFT_ARROW_ICON = new ImageIcon(ImageUtil.flipImage(ImageUtil.bufferedImageFromImage(RIGHT_ARROW_ICON.getImage()), true, false));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ import com.google.inject.Provides;
|
|||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
@@ -66,6 +65,7 @@ import net.runelite.client.plugins.Plugin;
|
|||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
import net.runelite.client.ui.NavigationButton;
|
import net.runelite.client.ui.NavigationButton;
|
||||||
import net.runelite.client.ui.ClientToolbar;
|
import net.runelite.client.ui.ClientToolbar;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
import net.runelite.client.util.StackFormatter;
|
import net.runelite.client.util.StackFormatter;
|
||||||
import net.runelite.client.util.Text;
|
import net.runelite.client.util.Text;
|
||||||
import net.runelite.http.api.osbuddy.GrandExchangeClient;
|
import net.runelite.http.api.osbuddy.GrandExchangeClient;
|
||||||
@@ -134,15 +134,11 @@ public class GrandExchangePlugin extends Plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void startUp() throws IOException
|
protected void startUp()
|
||||||
{
|
{
|
||||||
panel = injector.getInstance(GrandExchangePanel.class);
|
panel = injector.getInstance(GrandExchangePanel.class);
|
||||||
|
|
||||||
BufferedImage icon;
|
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "ge_icon.png");
|
||||||
synchronized (ImageIO.class)
|
|
||||||
{
|
|
||||||
icon = ImageIO.read(getClass().getResourceAsStream("ge_icon.png"));
|
|
||||||
}
|
|
||||||
|
|
||||||
button = NavigationButton.builder()
|
button = NavigationButton.builder()
|
||||||
.tooltip("Grand Exchange")
|
.tooltip("Grand Exchange")
|
||||||
|
|||||||
@@ -31,11 +31,9 @@ import java.awt.CardLayout;
|
|||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.GridBagConstraints;
|
import java.awt.GridBagConstraints;
|
||||||
import java.awt.GridBagLayout;
|
import java.awt.GridBagLayout;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
@@ -96,19 +94,9 @@ class GrandExchangeSearchPanel extends JPanel
|
|||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
try
|
SEARCH_ICON = new ImageIcon(ImageUtil.alphaOffset(ImageUtil.grayscaleOffset(ImageUtil.getResourceStreamFromClass(IconTextField.class, "search.png"), 0f), 1.75f));
|
||||||
{
|
LOADING_ICON = new ImageIcon(IconTextField.class.getResource("loading_spinner.gif"));
|
||||||
synchronized (ImageIO.class)
|
ERROR_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(IconTextField.class, "error.png"));
|
||||||
{
|
|
||||||
SEARCH_ICON = new ImageIcon(ImageUtil.alphaOffset(ImageUtil.grayscaleOffset(ImageIO.read(IconTextField.class.getResourceAsStream("search.png")), 0f), 1.75f));
|
|
||||||
LOADING_ICON = new ImageIcon(IconTextField.class.getResource("loading_spinner.gif"));
|
|
||||||
ERROR_ICON = new ImageIcon(ImageIO.read(IconTextField.class.getResourceAsStream("error.png")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GrandExchangeSearchPanel(Client client, ItemManager itemManager, ScheduledExecutorService executor)
|
GrandExchangeSearchPanel(Client client, ItemManager itemManager, ScheduledExecutorService executor)
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
@@ -57,6 +56,7 @@ import net.runelite.client.ui.PluginPanel;
|
|||||||
import net.runelite.client.ui.components.IconTextField;
|
import net.runelite.client.ui.components.IconTextField;
|
||||||
import net.runelite.client.ui.components.materialtabs.MaterialTab;
|
import net.runelite.client.ui.components.materialtabs.MaterialTab;
|
||||||
import net.runelite.client.ui.components.materialtabs.MaterialTabGroup;
|
import net.runelite.client.ui.components.materialtabs.MaterialTabGroup;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
import net.runelite.client.util.RunnableExceptionLogger;
|
import net.runelite.client.util.RunnableExceptionLogger;
|
||||||
import net.runelite.client.util.StackFormatter;
|
import net.runelite.client.util.StackFormatter;
|
||||||
import net.runelite.http.api.hiscore.HiscoreClient;
|
import net.runelite.http.api.hiscore.HiscoreClient;
|
||||||
@@ -146,19 +146,9 @@ public class HiscorePanel extends PluginPanel
|
|||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
try
|
SEARCH_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(IconTextField.class, "search.png"));
|
||||||
{
|
LOADING_ICON = new ImageIcon(IconTextField.class.getResource("loading_spinner_darker.gif"));
|
||||||
synchronized (ImageIO.class)
|
ERROR_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(IconTextField.class, "error.png"));
|
||||||
{
|
|
||||||
SEARCH_ICON = new ImageIcon(ImageIO.read(IconTextField.class.getResourceAsStream("search.png")));
|
|
||||||
LOADING_ICON = new ImageIcon(IconTextField.class.getResource("loading_spinner_darker.gif"));
|
|
||||||
ERROR_ICON = new ImageIcon(ImageIO.read(IconTextField.class.getResourceAsStream("error.png")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@@ -220,51 +210,39 @@ public class HiscorePanel extends PluginPanel
|
|||||||
|
|
||||||
for (HiscoreEndpoint endpoint : HiscoreEndpoint.values())
|
for (HiscoreEndpoint endpoint : HiscoreEndpoint.values())
|
||||||
{
|
{
|
||||||
try
|
final BufferedImage iconImage = ImageUtil.getResourceStreamFromClass(getClass(), endpoint.name().toLowerCase() + ".png");
|
||||||
|
|
||||||
|
MaterialTab tab = new MaterialTab(new ImageIcon(iconImage), tabGroup, null);
|
||||||
|
tab.setToolTipText(endpoint.getName() + " Hiscores");
|
||||||
|
tab.setOnSelectEvent(() ->
|
||||||
{
|
{
|
||||||
BufferedImage iconImage;
|
if (loading)
|
||||||
synchronized (ImageIO.class)
|
|
||||||
{
|
{
|
||||||
iconImage = ImageIO.read(HiscorePanel.class.getResourceAsStream(
|
return false;
|
||||||
endpoint.name().toLowerCase() + ".png"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MaterialTab tab = new MaterialTab(new ImageIcon(iconImage), tabGroup, null);
|
selectedEndPoint = endpoint;
|
||||||
tab.setToolTipText(endpoint.getName() + " Hiscores");
|
return true;
|
||||||
tab.setOnSelectEvent(() ->
|
});
|
||||||
|
|
||||||
|
// Adding the lookup method to a mouseListener instead of the above onSelectedEvent
|
||||||
|
// Because sometimes you might want to switch the tab, without calling for lookup
|
||||||
|
// Ex: selecting the normal hiscores as default
|
||||||
|
tab.addMouseListener(new MouseAdapter()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void mousePressed(MouseEvent mouseEvent)
|
||||||
{
|
{
|
||||||
if (loading)
|
if (loading)
|
||||||
{
|
{
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
selectedEndPoint = endpoint;
|
executor.execute(HiscorePanel.this::lookup);
|
||||||
return true;
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Adding the lookup method to a mouseListener instead of the above onSelectedEvent
|
tabGroup.addTab(tab);
|
||||||
// Because sometimes you might want to switch the tab, without calling for lookup
|
|
||||||
// Ex: selecting the normal hiscores as default
|
|
||||||
tab.addMouseListener(new MouseAdapter()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void mousePressed(MouseEvent mouseEvent)
|
|
||||||
{
|
|
||||||
if (loading)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
executor.execute(HiscorePanel.this::lookup);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
tabGroup.addTab(tab);
|
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(ex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default selected tab is normal hiscores
|
// Default selected tab is normal hiscores
|
||||||
@@ -343,19 +321,7 @@ public class HiscorePanel extends PluginPanel
|
|||||||
String skillIcon = directory + skillName + ".png";
|
String skillIcon = directory + skillName + ".png";
|
||||||
log.debug("Loading skill icon from {}", skillIcon);
|
log.debug("Loading skill icon from {}", skillIcon);
|
||||||
|
|
||||||
try
|
label.setIcon(new ImageIcon(ImageUtil.getResourceStreamFromClass(getClass(), skillIcon)));
|
||||||
{
|
|
||||||
BufferedImage icon;
|
|
||||||
synchronized (ImageIO.class)
|
|
||||||
{
|
|
||||||
icon = ImageIO.read(HiscorePanel.class.getResourceAsStream(skillIcon));
|
|
||||||
}
|
|
||||||
label.setIcon(new ImageIcon(icon));
|
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
log.warn(null, ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean totalLabel = skill == HiscoreSkill.OVERALL || skill == null; //overall or combat
|
boolean totalLabel = skill == HiscoreSkill.OVERALL || skill == null; //overall or combat
|
||||||
label.setIconTextGap(totalLabel ? 10 : 4);
|
label.setIconTextGap(totalLabel ? 10 : 4);
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ import java.awt.image.BufferedImage;
|
|||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Provider;
|
import javax.inject.Provider;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
@@ -49,6 +48,7 @@ import net.runelite.client.plugins.Plugin;
|
|||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
import net.runelite.client.ui.NavigationButton;
|
import net.runelite.client.ui.NavigationButton;
|
||||||
import net.runelite.client.ui.ClientToolbar;
|
import net.runelite.client.ui.ClientToolbar;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
import net.runelite.client.util.Text;
|
import net.runelite.client.util.Text;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
|
||||||
@@ -98,11 +98,7 @@ public class HiscorePlugin extends Plugin
|
|||||||
{
|
{
|
||||||
hiscorePanel = injector.getInstance(HiscorePanel.class);
|
hiscorePanel = injector.getInstance(HiscorePanel.class);
|
||||||
|
|
||||||
BufferedImage icon;
|
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "normal.png");
|
||||||
synchronized (ImageIO.class)
|
|
||||||
{
|
|
||||||
icon = ImageIO.read(getClass().getResourceAsStream("normal.png"));
|
|
||||||
}
|
|
||||||
|
|
||||||
navButton = NavigationButton.builder()
|
navButton = NavigationButton.builder()
|
||||||
.tooltip("Hiscore")
|
.tooltip("Hiscore")
|
||||||
|
|||||||
@@ -36,10 +36,8 @@ import java.awt.Font;
|
|||||||
import java.awt.GridLayout;
|
import java.awt.GridLayout;
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import javax.swing.Box;
|
import javax.swing.Box;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
@@ -56,6 +54,7 @@ import net.runelite.client.account.SessionManager;
|
|||||||
import net.runelite.client.ui.ColorScheme;
|
import net.runelite.client.ui.ColorScheme;
|
||||||
import net.runelite.client.ui.FontManager;
|
import net.runelite.client.ui.FontManager;
|
||||||
import net.runelite.client.ui.PluginPanel;
|
import net.runelite.client.ui.PluginPanel;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
import net.runelite.client.util.LinkBrowser;
|
import net.runelite.client.util.LinkBrowser;
|
||||||
import net.runelite.client.util.RunnableExceptionLogger;
|
import net.runelite.client.util.RunnableExceptionLogger;
|
||||||
|
|
||||||
@@ -92,21 +91,11 @@ public class InfoPanel extends PluginPanel
|
|||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
try
|
ARROW_RIGHT_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(InfoPanel.class, "/util/arrow_right.png"));
|
||||||
{
|
GITHUB_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(InfoPanel.class, "github_icon.png"));
|
||||||
synchronized (ImageIO.class)
|
DISCORD_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(InfoPanel.class, "discord_icon.png"));
|
||||||
{
|
PATREON_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(InfoPanel.class, "patreon_icon.png"));
|
||||||
ARROW_RIGHT_ICON = new ImageIcon(ImageIO.read(InfoPanel.class.getResourceAsStream("/util/arrow_right.png")));
|
WIKI_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(InfoPanel.class, "wiki_icon.png"));
|
||||||
GITHUB_ICON = new ImageIcon(ImageIO.read(InfoPanel.class.getResourceAsStream("github_icon.png")));
|
|
||||||
DISCORD_ICON = new ImageIcon(ImageIO.read(InfoPanel.class.getResourceAsStream("discord_icon.png")));
|
|
||||||
PATREON_ICON = new ImageIcon(ImageIO.read(InfoPanel.class.getResourceAsStream("patreon_icon.png")));
|
|
||||||
WIKI_ICON = new ImageIcon(ImageIO.read(InfoPanel.class.getResourceAsStream("wiki_icon.png")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void init()
|
void init()
|
||||||
|
|||||||
@@ -25,12 +25,12 @@
|
|||||||
package net.runelite.client.plugins.info;
|
package net.runelite.client.plugins.info;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
import net.runelite.client.ui.NavigationButton;
|
import net.runelite.client.ui.NavigationButton;
|
||||||
import net.runelite.client.ui.ClientToolbar;
|
import net.runelite.client.ui.ClientToolbar;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Info Panel",
|
name = "Info Panel",
|
||||||
@@ -50,11 +50,7 @@ public class InfoPlugin extends Plugin
|
|||||||
final InfoPanel panel = injector.getInstance(InfoPanel.class);
|
final InfoPanel panel = injector.getInstance(InfoPanel.class);
|
||||||
panel.init();
|
panel.init();
|
||||||
|
|
||||||
BufferedImage icon;
|
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "info_icon.png");
|
||||||
synchronized (ImageIO.class)
|
|
||||||
{
|
|
||||||
icon = ImageIO.read(getClass().getResourceAsStream("info_icon.png"));
|
|
||||||
}
|
|
||||||
|
|
||||||
navButton = NavigationButton.builder()
|
navButton = NavigationButton.builder()
|
||||||
.tooltip("Info")
|
.tooltip("Info")
|
||||||
|
|||||||
@@ -33,14 +33,12 @@ import java.awt.GridBagLayout;
|
|||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.GroupLayout;
|
import javax.swing.GroupLayout;
|
||||||
@@ -67,19 +65,9 @@ class KourendLibraryPanel extends PluginPanel
|
|||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
try
|
final BufferedImage resetIcon = ImageUtil.getResourceStreamFromClass(KourendLibraryPanel.class, "/util/reset.png");
|
||||||
{
|
RESET_ICON = new ImageIcon(resetIcon);
|
||||||
synchronized (ImageIO.class)
|
RESET_CLICK_ICON = new ImageIcon(ImageUtil.alphaOffset(resetIcon, -100));
|
||||||
{
|
|
||||||
BufferedImage resetIcon = ImageIO.read(KourendLibraryPanel.class.getResourceAsStream("/util/reset.png"));
|
|
||||||
RESET_ICON = new ImageIcon(resetIcon);
|
|
||||||
RESET_CLICK_ICON = new ImageIcon(ImageUtil.alphaOffset(resetIcon, -100));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void init()
|
void init()
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import com.google.inject.Provides;
|
|||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -53,6 +52,7 @@ import net.runelite.client.plugins.PluginDescriptor;
|
|||||||
import net.runelite.client.ui.NavigationButton;
|
import net.runelite.client.ui.NavigationButton;
|
||||||
import net.runelite.client.ui.ClientToolbar;
|
import net.runelite.client.ui.ClientToolbar;
|
||||||
import net.runelite.client.ui.overlay.OverlayManager;
|
import net.runelite.client.ui.overlay.OverlayManager;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Kourend Library",
|
name = "Kourend Library",
|
||||||
@@ -109,11 +109,7 @@ public class KourendLibraryPlugin extends Plugin
|
|||||||
panel = injector.getInstance(KourendLibraryPanel.class);
|
panel = injector.getInstance(KourendLibraryPanel.class);
|
||||||
panel.init();
|
panel.init();
|
||||||
|
|
||||||
BufferedImage icon;
|
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "panel_icon.png");
|
||||||
synchronized (ImageIO.class)
|
|
||||||
{
|
|
||||||
icon = ImageIO.read(Book.class.getResourceAsStream("panel_icon.png"));
|
|
||||||
}
|
|
||||||
|
|
||||||
navButton = NavigationButton.builder()
|
navButton = NavigationButton.builder()
|
||||||
.tooltip("Kourend Library")
|
.tooltip("Kourend Library")
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ import java.util.List;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -59,6 +58,7 @@ import net.runelite.client.plugins.Plugin;
|
|||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
import net.runelite.client.ui.ClientToolbar;
|
import net.runelite.client.ui.ClientToolbar;
|
||||||
import net.runelite.client.ui.NavigationButton;
|
import net.runelite.client.ui.NavigationButton;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
import net.runelite.client.util.Text;
|
import net.runelite.client.util.Text;
|
||||||
import net.runelite.http.api.item.ItemPrice;
|
import net.runelite.http.api.item.ItemPrice;
|
||||||
|
|
||||||
@@ -125,11 +125,7 @@ public class LootTrackerPlugin extends Plugin
|
|||||||
panel = new LootTrackerPanel(itemManager);
|
panel = new LootTrackerPanel(itemManager);
|
||||||
spriteManager.getSpriteAsync(SpriteID.UNUSED_TAB_INVENTORY, 0, panel::loadHeaderIcon);
|
spriteManager.getSpriteAsync(SpriteID.UNUSED_TAB_INVENTORY, 0, panel::loadHeaderIcon);
|
||||||
|
|
||||||
final BufferedImage icon;
|
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "panel_icon.png");
|
||||||
synchronized (ImageIO.class)
|
|
||||||
{
|
|
||||||
icon = ImageIO.read(LootTrackerPanel.class.getResourceAsStream("panel_icon.png"));
|
|
||||||
}
|
|
||||||
|
|
||||||
navButton = NavigationButton.builder()
|
navButton = NavigationButton.builder()
|
||||||
.tooltip("Loot Tracker")
|
.tooltip("Loot Tracker")
|
||||||
|
|||||||
@@ -25,12 +25,11 @@
|
|||||||
package net.runelite.client.plugins.mta.alchemy;
|
package net.runelite.client.plugins.mta.alchemy;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
import net.runelite.client.ui.overlay.infobox.Timer;
|
import net.runelite.client.ui.overlay.infobox.Timer;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class AlchemyRoomTimer extends Timer
|
public class AlchemyRoomTimer extends Timer
|
||||||
@@ -51,17 +50,7 @@ public class AlchemyRoomTimer extends Timer
|
|||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
image = ImageUtil.getResourceStreamFromClass(AlchemyRoomTimer.class, "/util/reset.png");
|
||||||
{
|
|
||||||
synchronized (ImageIO.class)
|
|
||||||
{
|
|
||||||
image = ImageIO.read(AlchemyRoomTimer.class.getResourceAsStream("/util/reset.png"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
log.warn(null, ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ package net.runelite.client.plugins.notes;
|
|||||||
import com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.api.events.SessionOpen;
|
import net.runelite.api.events.SessionOpen;
|
||||||
@@ -36,6 +35,7 @@ import net.runelite.client.plugins.Plugin;
|
|||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
import net.runelite.client.ui.NavigationButton;
|
import net.runelite.client.ui.NavigationButton;
|
||||||
import net.runelite.client.ui.ClientToolbar;
|
import net.runelite.client.ui.ClientToolbar;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Notes",
|
name = "Notes",
|
||||||
@@ -67,11 +67,7 @@ public class NotesPlugin extends Plugin
|
|||||||
panel = injector.getInstance(NotesPanel.class);
|
panel = injector.getInstance(NotesPanel.class);
|
||||||
panel.init(config);
|
panel.init(config);
|
||||||
|
|
||||||
BufferedImage icon;
|
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "notes_icon.png");
|
||||||
synchronized (ImageIO.class)
|
|
||||||
{
|
|
||||||
icon = ImageIO.read(getClass().getResourceAsStream("notes_icon.png"));
|
|
||||||
}
|
|
||||||
|
|
||||||
navButton = NavigationButton.builder()
|
navButton = NavigationButton.builder()
|
||||||
.tooltip("Notes")
|
.tooltip("Notes")
|
||||||
|
|||||||
@@ -25,14 +25,13 @@
|
|||||||
package net.runelite.client.plugins.poh;
|
package net.runelite.client.plugins.poh;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import static net.runelite.api.ObjectID.*;
|
import static net.runelite.api.ObjectID.*;
|
||||||
import static net.runelite.api.NullObjectID.*;
|
import static net.runelite.api.NullObjectID.*;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public enum PohIcons
|
public enum PohIcons
|
||||||
@@ -105,17 +104,7 @@ public enum PohIcons
|
|||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
image = ImageUtil.getResourceStreamFromClass(getClass(), getImageResource() + ".png");
|
||||||
{
|
|
||||||
synchronized (ImageIO.class)
|
|
||||||
{
|
|
||||||
image = ImageIO.read(PohIcons.class.getResourceAsStream(getImageResource() + ".png"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
log.warn("unable to load image", ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@@ -53,6 +52,7 @@ import net.runelite.client.plugins.screenmarkers.ui.ScreenMarkerPluginPanel;
|
|||||||
import net.runelite.client.ui.NavigationButton;
|
import net.runelite.client.ui.NavigationButton;
|
||||||
import net.runelite.client.ui.ClientToolbar;
|
import net.runelite.client.ui.ClientToolbar;
|
||||||
import net.runelite.client.ui.overlay.OverlayManager;
|
import net.runelite.client.ui.overlay.OverlayManager;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Screen Markers",
|
name = "Screen Markers",
|
||||||
@@ -108,11 +108,7 @@ public class ScreenMarkerPlugin extends Plugin
|
|||||||
pluginPanel = injector.getInstance(ScreenMarkerPluginPanel.class);
|
pluginPanel = injector.getInstance(ScreenMarkerPluginPanel.class);
|
||||||
pluginPanel.rebuild();
|
pluginPanel.rebuild();
|
||||||
|
|
||||||
BufferedImage icon;
|
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), ICON_FILE);
|
||||||
synchronized (ImageIO.class)
|
|
||||||
{
|
|
||||||
icon = ImageIO.read(ScreenMarkerPlugin.class.getResourceAsStream(ICON_FILE));
|
|
||||||
}
|
|
||||||
|
|
||||||
navigationButton = NavigationButton.builder()
|
navigationButton = NavigationButton.builder()
|
||||||
.tooltip(PLUGIN_NAME)
|
.tooltip(PLUGIN_NAME)
|
||||||
|
|||||||
@@ -30,8 +30,6 @@ import java.awt.GridLayout;
|
|||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
@@ -56,18 +54,8 @@ public class ScreenMarkerCreationPanel extends JPanel
|
|||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
try
|
CONFIRM_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(ScreenMarkerPlugin.class, "confirm_icon.png"));
|
||||||
{
|
CANCEL_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(ScreenMarkerPlugin.class, "cancel_icon.png"));
|
||||||
synchronized (ImageIO.class)
|
|
||||||
{
|
|
||||||
CONFIRM_ICON = new ImageIcon(ImageIO.read(ScreenMarkerPlugin.class.getResourceAsStream("confirm_icon.png")));
|
|
||||||
CANCEL_ICON = new ImageIcon(ImageIO.read(ScreenMarkerPlugin.class.getResourceAsStream("cancel_icon.png")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
final BufferedImage confirmIcon = ImageUtil.bufferedImageFromImage(CONFIRM_ICON.getImage());
|
final BufferedImage confirmIcon = ImageUtil.bufferedImageFromImage(CONFIRM_ICON.getImage());
|
||||||
CONFIRM_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(confirmIcon, 0.54f));
|
CONFIRM_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(confirmIcon, 0.54f));
|
||||||
|
|||||||
@@ -34,8 +34,6 @@ import java.awt.event.MouseEvent;
|
|||||||
import java.awt.event.WindowAdapter;
|
import java.awt.event.WindowAdapter;
|
||||||
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowEvent;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JColorChooser;
|
import javax.swing.JColorChooser;
|
||||||
@@ -108,48 +106,38 @@ class ScreenMarkerPanel extends JPanel
|
|||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
try
|
final BufferedImage borderImg = ImageUtil.getResourceStreamFromClass(ScreenMarkerPlugin.class, "border_color_icon.png");
|
||||||
{
|
BORDER_COLOR_ICON = new ImageIcon(borderImg);
|
||||||
synchronized (ImageIO.class)
|
BORDER_COLOR_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(borderImg, -100));
|
||||||
{
|
|
||||||
BufferedImage borderImg = ImageIO.read(ScreenMarkerPlugin.class.getResourceAsStream("border_color_icon.png"));
|
|
||||||
BORDER_COLOR_ICON = new ImageIcon(borderImg);
|
|
||||||
BORDER_COLOR_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(borderImg, -100));
|
|
||||||
|
|
||||||
BufferedImage noBorderImg = ImageIO.read(ScreenMarkerPlugin.class.getResourceAsStream("no_border_color_icon.png"));
|
final BufferedImage noBorderImg = ImageUtil.getResourceStreamFromClass(ScreenMarkerPlugin.class, "no_border_color_icon.png");
|
||||||
NO_BORDER_COLOR_ICON = new ImageIcon(noBorderImg);
|
NO_BORDER_COLOR_ICON = new ImageIcon(noBorderImg);
|
||||||
NO_BORDER_COLOR_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(noBorderImg, -100));
|
NO_BORDER_COLOR_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(noBorderImg, -100));
|
||||||
|
|
||||||
BufferedImage fillImg = ImageIO.read(ScreenMarkerPlugin.class.getResourceAsStream("fill_color_icon.png"));
|
final BufferedImage fillImg = ImageUtil.getResourceStreamFromClass(ScreenMarkerPlugin.class, "fill_color_icon.png");
|
||||||
FILL_COLOR_ICON = new ImageIcon(fillImg);
|
FILL_COLOR_ICON = new ImageIcon(fillImg);
|
||||||
FILL_COLOR_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(fillImg, -100));
|
FILL_COLOR_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(fillImg, -100));
|
||||||
|
|
||||||
BufferedImage noFillImg = ImageIO.read(ScreenMarkerPlugin.class.getResourceAsStream("no_fill_color_icon.png"));
|
final BufferedImage noFillImg = ImageUtil.getResourceStreamFromClass(ScreenMarkerPlugin.class, "no_fill_color_icon.png");
|
||||||
NO_FILL_COLOR_ICON = new ImageIcon(noFillImg);
|
NO_FILL_COLOR_ICON = new ImageIcon(noFillImg);
|
||||||
NO_FILL_COLOR_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(noFillImg, -100));
|
NO_FILL_COLOR_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(noFillImg, -100));
|
||||||
|
|
||||||
BufferedImage opacityImg = ImageIO.read(ScreenMarkerPlugin.class.getResourceAsStream("opacity_icon.png"));
|
final BufferedImage opacityImg = ImageUtil.getResourceStreamFromClass(ScreenMarkerPlugin.class, "opacity_icon.png");
|
||||||
FULL_OPACITY_ICON = new ImageIcon(opacityImg);
|
FULL_OPACITY_ICON = new ImageIcon(opacityImg);
|
||||||
OPACITY_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(opacityImg, -100));
|
OPACITY_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(opacityImg, -100));
|
||||||
NO_OPACITY_ICON = new ImageIcon(ImageUtil.alphaOffset(opacityImg, -150));
|
NO_OPACITY_ICON = new ImageIcon(ImageUtil.alphaOffset(opacityImg, -150));
|
||||||
|
|
||||||
BufferedImage visibleImg = ImageIO.read(ScreenMarkerPlugin.class.getResourceAsStream("visible_icon.png"));
|
final BufferedImage visibleImg = ImageUtil.getResourceStreamFromClass(ScreenMarkerPlugin.class, "visible_icon.png");
|
||||||
VISIBLE_ICON = new ImageIcon(visibleImg);
|
VISIBLE_ICON = new ImageIcon(visibleImg);
|
||||||
VISIBLE_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(visibleImg, -100));
|
VISIBLE_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(visibleImg, -100));
|
||||||
|
|
||||||
BufferedImage invisibleImg = ImageIO.read(ScreenMarkerPlugin.class.getResourceAsStream("invisible_icon.png"));
|
final BufferedImage invisibleImg = ImageUtil.getResourceStreamFromClass(ScreenMarkerPlugin.class, "invisible_icon.png");
|
||||||
INVISIBLE_ICON = new ImageIcon(invisibleImg);
|
INVISIBLE_ICON = new ImageIcon(invisibleImg);
|
||||||
INVISIBLE_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(invisibleImg, -100));
|
INVISIBLE_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(invisibleImg, -100));
|
||||||
|
|
||||||
BufferedImage deleteImg = ImageIO.read(ScreenMarkerPlugin.class.getResourceAsStream("delete_icon.png"));
|
final BufferedImage deleteImg = ImageUtil.getResourceStreamFromClass(ScreenMarkerPlugin.class, "delete_icon.png");
|
||||||
DELETE_ICON = new ImageIcon(deleteImg);
|
DELETE_ICON = new ImageIcon(deleteImg);
|
||||||
DELETE_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(deleteImg, -100));
|
DELETE_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(deleteImg, -100));
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ScreenMarkerPanel(ScreenMarkerPlugin plugin, ScreenMarkerOverlay marker)
|
ScreenMarkerPanel(ScreenMarkerPlugin plugin, ScreenMarkerOverlay marker)
|
||||||
|
|||||||
@@ -34,8 +34,7 @@ import java.awt.GridBagConstraints;
|
|||||||
import java.awt.GridBagLayout;
|
import java.awt.GridBagLayout;
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.io.IOException;
|
import java.awt.image.BufferedImage;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.swing.Box;
|
import javax.swing.Box;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
@@ -81,19 +80,9 @@ public class ScreenMarkerPluginPanel extends PluginPanel
|
|||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
try
|
final BufferedImage addIcon = ImageUtil.getResourceStreamFromClass(ScreenMarkerPlugin.class, "add_icon.png");
|
||||||
{
|
ADD_ICON = new ImageIcon(addIcon);
|
||||||
synchronized (ImageIO.class)
|
ADD_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(addIcon, 0.53f));
|
||||||
{
|
|
||||||
ADD_ICON = new ImageIcon(ImageIO.read(ScreenMarkerPlugin.class.getResourceAsStream("add_icon.png")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
ADD_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(ImageUtil.bufferedImageFromImage(ADD_ICON.getImage()), 0.53f));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init()
|
public void init()
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ import net.runelite.client.ui.DrawManager;
|
|||||||
import net.runelite.client.ui.NavigationButton;
|
import net.runelite.client.ui.NavigationButton;
|
||||||
import net.runelite.client.ui.overlay.OverlayManager;
|
import net.runelite.client.ui.overlay.OverlayManager;
|
||||||
import net.runelite.client.util.HotkeyListener;
|
import net.runelite.client.util.HotkeyListener;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
import net.runelite.client.util.Text;
|
import net.runelite.client.util.Text;
|
||||||
import net.runelite.http.api.RuneLiteAPI;
|
import net.runelite.http.api.RuneLiteAPI;
|
||||||
import okhttp3.Call;
|
import okhttp3.Call;
|
||||||
@@ -205,41 +206,30 @@ public class ScreenshotPlugin extends Plugin
|
|||||||
SCREENSHOT_DIR.mkdirs();
|
SCREENSHOT_DIR.mkdirs();
|
||||||
keyManager.registerKeyListener(hotkeyListener);
|
keyManager.registerKeyListener(hotkeyListener);
|
||||||
|
|
||||||
try
|
final BufferedImage iconImage = ImageUtil.getResourceStreamFromClass(getClass(), "screenshot.png");
|
||||||
{
|
|
||||||
BufferedImage iconImage;
|
|
||||||
synchronized (ImageIO.class)
|
|
||||||
{
|
|
||||||
iconImage = ImageIO.read(ScreenshotPlugin.class.getResourceAsStream("screenshot.png"));
|
|
||||||
}
|
|
||||||
|
|
||||||
titleBarButton = NavigationButton.builder()
|
titleBarButton = NavigationButton.builder()
|
||||||
.tab(false)
|
.tab(false)
|
||||||
.tooltip("Take screenshot")
|
.tooltip("Take screenshot")
|
||||||
.icon(iconImage)
|
.icon(iconImage)
|
||||||
.onClick(() -> takeScreenshot(format(new Date())))
|
.onClick(() -> takeScreenshot(format(new Date())))
|
||||||
.popup(ImmutableMap
|
.popup(ImmutableMap
|
||||||
.<String, Runnable>builder()
|
.<String, Runnable>builder()
|
||||||
.put("Open screenshot folder...", () ->
|
.put("Open screenshot folder...", () ->
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
try
|
Desktop.getDesktop().open(SCREENSHOT_DIR);
|
||||||
{
|
}
|
||||||
Desktop.getDesktop().open(SCREENSHOT_DIR);
|
catch (IOException ex)
|
||||||
}
|
{
|
||||||
catch (IOException ex)
|
log.warn("Error opening screenshot dir", ex);
|
||||||
{
|
}
|
||||||
log.warn("Error opening screenshot dir", ex);
|
})
|
||||||
}
|
.build())
|
||||||
})
|
.build();
|
||||||
.build())
|
|
||||||
.build();
|
|
||||||
|
|
||||||
clientToolbar.addNavigation(titleBarButton);
|
clientToolbar.addNavigation(titleBarButton);
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
log.warn("Error adding screenshot button to titlebar", ex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
package net.runelite.client.plugins.skillcalculator;
|
package net.runelite.client.plugins.skillcalculator;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.client.game.ItemManager;
|
import net.runelite.client.game.ItemManager;
|
||||||
@@ -37,6 +36,7 @@ import net.runelite.client.plugins.PluginDescriptor;
|
|||||||
import net.runelite.client.ui.ClientUI;
|
import net.runelite.client.ui.ClientUI;
|
||||||
import net.runelite.client.ui.NavigationButton;
|
import net.runelite.client.ui.NavigationButton;
|
||||||
import net.runelite.client.ui.ClientToolbar;
|
import net.runelite.client.ui.ClientToolbar;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Skill Calculator",
|
name = "Skill Calculator",
|
||||||
@@ -69,11 +69,7 @@ public class SkillCalculatorPlugin extends Plugin
|
|||||||
@Override
|
@Override
|
||||||
protected void startUp() throws Exception
|
protected void startUp() throws Exception
|
||||||
{
|
{
|
||||||
BufferedImage icon;
|
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "calc.png");
|
||||||
synchronized (ImageIO.class)
|
|
||||||
{
|
|
||||||
icon = ImageIO.read(getClass().getResourceAsStream("calc.png"));
|
|
||||||
}
|
|
||||||
|
|
||||||
SkillCalculator.spriteManager = spriteManager;
|
SkillCalculator.spriteManager = spriteManager;
|
||||||
SkillCalculator.itemManager = itemManager;
|
SkillCalculator.itemManager = itemManager;
|
||||||
|
|||||||
@@ -25,10 +25,9 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.worldmap;
|
package net.runelite.client.plugins.worldmap;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.runelite.client.ui.overlay.worldmap.WorldMapPoint;
|
import net.runelite.client.ui.overlay.worldmap.WorldMapPoint;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
|
|
||||||
class TeleportPoint extends WorldMapPoint
|
class TeleportPoint extends WorldMapPoint
|
||||||
{
|
{
|
||||||
@@ -42,13 +41,6 @@ class TeleportPoint extends WorldMapPoint
|
|||||||
this.data = data;
|
this.data = data;
|
||||||
setTooltip(data.getTooltip());
|
setTooltip(data.getTooltip());
|
||||||
|
|
||||||
try
|
setImage(ImageUtil.getResourceStreamFromClass(WorldMapPlugin.class, data.getIconPath()));
|
||||||
{
|
|
||||||
setImage(ImageIO.read(WorldMapPlugin.class.getResourceAsStream(data.getIconPath())));
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,9 +29,7 @@ import com.google.common.eventbus.Subscribe;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.Experience;
|
import net.runelite.api.Experience;
|
||||||
import net.runelite.api.Skill;
|
import net.runelite.api.Skill;
|
||||||
@@ -41,6 +39,7 @@ import net.runelite.client.config.ConfigManager;
|
|||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
import net.runelite.client.ui.overlay.worldmap.WorldMapPointManager;
|
import net.runelite.client.ui.overlay.worldmap.WorldMapPointManager;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "World Map",
|
name = "World Map",
|
||||||
@@ -73,23 +72,13 @@ public class WorldMapPlugin extends Plugin
|
|||||||
|
|
||||||
BLANK_ICON = new BufferedImage(iconBufferSize, iconBufferSize, BufferedImage.TYPE_INT_ARGB);
|
BLANK_ICON = new BufferedImage(iconBufferSize, iconBufferSize, BufferedImage.TYPE_INT_ARGB);
|
||||||
|
|
||||||
try
|
FAIRY_TRAVEL_ICON = new BufferedImage(iconBufferSize, iconBufferSize, BufferedImage.TYPE_INT_ARGB);
|
||||||
{
|
final BufferedImage fairyTravelIcon = ImageUtil.getResourceStreamFromClass(WorldMapPlugin.class, "fairy_ring_travel.png");
|
||||||
synchronized (ImageIO.class)
|
FAIRY_TRAVEL_ICON.getGraphics().drawImage(fairyTravelIcon, 1, 1, null);
|
||||||
{
|
|
||||||
FAIRY_TRAVEL_ICON = new BufferedImage(iconBufferSize, iconBufferSize, BufferedImage.TYPE_INT_ARGB);
|
|
||||||
final BufferedImage icon = ImageIO.read(WorldMapPlugin.class.getResourceAsStream("fairy_ring_travel.png"));
|
|
||||||
FAIRY_TRAVEL_ICON.getGraphics().drawImage(icon, 1, 1, null);
|
|
||||||
|
|
||||||
NOPE_ICON = new BufferedImage(iconBufferSize, iconBufferSize, BufferedImage.TYPE_INT_ARGB);
|
NOPE_ICON = new BufferedImage(iconBufferSize, iconBufferSize, BufferedImage.TYPE_INT_ARGB);
|
||||||
final BufferedImage nopeImage = ImageIO.read(WorldMapPlugin.class.getResourceAsStream("nope_icon.png"));
|
final BufferedImage nopeImage = ImageUtil.getResourceStreamFromClass(WorldMapPlugin.class, "nope_icon.png");
|
||||||
NOPE_ICON.getGraphics().drawImage(nopeImage, 1, 1, null);
|
NOPE_ICON.getGraphics().drawImage(nopeImage, 1, 1, null);
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ import java.awt.image.BufferedImage;
|
|||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
@@ -53,6 +52,7 @@ import static net.runelite.client.plugins.xptracker.XpWorldType.NORMAL;
|
|||||||
import net.runelite.client.task.Schedule;
|
import net.runelite.client.task.Schedule;
|
||||||
import net.runelite.client.ui.NavigationButton;
|
import net.runelite.client.ui.NavigationButton;
|
||||||
import net.runelite.client.ui.ClientToolbar;
|
import net.runelite.client.ui.ClientToolbar;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
import net.runelite.http.api.xp.XpClient;
|
import net.runelite.http.api.xp.XpClient;
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
@@ -102,11 +102,7 @@ public class XpTrackerPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
xpPanel = new XpPanel(this, client, skillIconManager);
|
xpPanel = new XpPanel(this, client, skillIconManager);
|
||||||
|
|
||||||
BufferedImage icon;
|
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "/skill_icons/overall.png");
|
||||||
synchronized (ImageIO.class)
|
|
||||||
{
|
|
||||||
icon = ImageIO.read(getClass().getResourceAsStream("/skill_icons/overall.png"));
|
|
||||||
}
|
|
||||||
|
|
||||||
navButton = NavigationButton.builder()
|
navButton = NavigationButton.builder()
|
||||||
.tooltip("XP Tracker")
|
.tooltip("XP Tracker")
|
||||||
|
|||||||
@@ -38,9 +38,7 @@ import java.awt.LayoutManager;
|
|||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import java.awt.TrayIcon;
|
import java.awt.TrayIcon;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import javax.swing.BoxLayout;
|
import javax.swing.BoxLayout;
|
||||||
@@ -96,24 +94,8 @@ public class ClientUI
|
|||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
BufferedImage icon;
|
ICON = ImageUtil.getResourceStreamFromClass(ClientUI.class, "/runelite.png");
|
||||||
BufferedImage sidebarOpen;
|
SIDEBAR_OPEN = ImageUtil.getResourceStreamFromClass(ClientUI.class, "open.png");
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
synchronized (ImageIO.class)
|
|
||||||
{
|
|
||||||
icon = ImageIO.read(ClientUI.class.getResourceAsStream("/runelite.png"));
|
|
||||||
sidebarOpen = ImageIO.read(ClientUI.class.getResourceAsStream("open.png"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
ICON = icon;
|
|
||||||
SIDEBAR_OPEN = sidebarOpen;
|
|
||||||
SIDEBAR_CLOSE = ImageUtil.flipImage(SIDEBAR_OPEN, true, false);
|
SIDEBAR_CLOSE = ImageUtil.flipImage(SIDEBAR_OPEN, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,9 @@ import java.awt.geom.AffineTransform;
|
|||||||
import java.awt.image.AffineTransformOp;
|
import java.awt.image.AffineTransformOp;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.awt.image.RescaleOp;
|
import java.awt.image.RescaleOp;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
import javax.swing.GrayFilter;
|
import javax.swing.GrayFilter;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
@@ -328,6 +330,30 @@ public class ImageUtil
|
|||||||
return outlinedImage;
|
return outlinedImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads an image resource from a given path relative to a given class.
|
||||||
|
* This method is primarily shorthand for the synchronization and error handling required for
|
||||||
|
* loading image resources from classes.
|
||||||
|
*
|
||||||
|
* @param c The class to be referenced for resource path.
|
||||||
|
* @param path The path, relative to the given class.
|
||||||
|
* @return A {@link BufferedImage} of the loaded image resource from the given path.
|
||||||
|
*/
|
||||||
|
public static BufferedImage getResourceStreamFromClass(final Class c, final String path)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
synchronized (ImageIO.class)
|
||||||
|
{
|
||||||
|
return ImageIO.read(c.getResourceAsStream(path));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fills all non-transparent pixels of the given image with the given color.
|
* Fills all non-transparent pixels of the given image with the given color.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user