Expanded SkillIconManager to include smaller versions
Needed small icons to use for the Skill Calc redesign, decided to expand the skill icon manager to include these, created a new folder in the resources with the small png's.
This commit is contained in:
@@ -35,11 +35,12 @@ import net.runelite.api.Skill;
|
||||
@Slf4j
|
||||
public class SkillIconManager
|
||||
{
|
||||
private final BufferedImage[] imgCache = new BufferedImage[Skill.values().length];
|
||||
// * 2 to account for the small version of each icon
|
||||
private final BufferedImage[] imgCache = new BufferedImage[Skill.values().length * 2];
|
||||
|
||||
public BufferedImage getSkillImage(Skill skill)
|
||||
public BufferedImage getSkillImage(Skill skill, boolean small)
|
||||
{
|
||||
int skillIdx = skill.ordinal();
|
||||
int skillIdx = skill.ordinal() + (small ? Skill.values().length : 0);
|
||||
BufferedImage skillImage = null;
|
||||
|
||||
if (imgCache[skillIdx] != null)
|
||||
@@ -49,7 +50,8 @@ public class SkillIconManager
|
||||
|
||||
try
|
||||
{
|
||||
String skillIconPath = "/skill_icons/" + skill.getName().toLowerCase() + ".png";
|
||||
String skillIconPath = (small ? "/skill_icons_small/" : "/skill_icons/")
|
||||
+ skill.getName().toLowerCase() + ".png";
|
||||
log.debug("Loading skill icon from {}", skillIconPath);
|
||||
synchronized (ImageIO.class)
|
||||
{
|
||||
@@ -64,4 +66,10 @@ public class SkillIconManager
|
||||
|
||||
return skillImage;
|
||||
}
|
||||
|
||||
public BufferedImage getSkillImage(Skill skill)
|
||||
{
|
||||
return getSkillImage(skill, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user