java.lang.Object com.realtime.crossfire.jxclient.skin.io.ImageParser
public class ImageParser
Creates BufferedImage
instances from string representations. Each
image is loaded only once.
Field Summary | |
---|---|
private JXCSkinCache<java.awt.image.BufferedImage> |
definedImages
All defined images. |
private JXCSkinSource |
skinSource
The JXCSkinSource for loading resources. |
Constructor Summary | |
---|---|
ImageParser(JXCSkinSource skinSource)
Creates a new instance. |
Method Summary | |
---|---|
void |
clear()
Forgets all defined images. |
java.awt.image.BufferedImage |
getImage(java.awt.Color color,
java.lang.String name)
Optionally loads an image by base file name. |
java.awt.image.BufferedImage |
getImage(java.lang.String name)
Loads an image by base file name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
@NotNull private final JXCSkinCache<java.awt.image.BufferedImage> definedImages
@NotNull private final JXCSkinSource skinSource
JXCSkinSource
for loading resources.
Constructor Detail |
---|
public ImageParser(@NotNull JXCSkinSource skinSource)
skinSource
- the skin source for loading resourcesMethod Detail |
---|
public void clear()
@Nullable public java.awt.image.BufferedImage getImage(@Nullable java.awt.Color color, @NotNull java.lang.String name) throws java.io.IOException
color
- if non-null
, return null
name
- the base file name
null
if color!=null
java.io.IOException
- if the image cannot be loaded@NotNull public java.awt.image.BufferedImage getImage(@NotNull java.lang.String name) throws java.io.IOException
name
- the base file name
java.io.IOException
- if the image cannot be loaded