 |
Crossfire JXClient, Trunk
|
Go to the documentation of this file.
23 package com.realtime.crossfire.jxclient.skin.io;
28 import java.awt.Color;
29 import java.awt.Image;
30 import java.awt.image.BufferedImage;
31 import java.io.IOException;
32 import java.io.InputStream;
33 import javax.imageio.ImageIO;
34 import org.jetbrains.annotations.NotNull;
35 import org.jetbrains.annotations.Nullable;
79 public Image
getImage(@Nullable
final Color color, @NotNull
final String name)
throws IOException {
81 return color ==
null ?
getImage(name) :
null;
91 public BufferedImage
getImage(@NotNull
final String name)
throws IOException {
98 final String filename =
"pictures/"+name+
".png";
99 final BufferedImage image;
101 image = ImageIO.read(inputStream);
104 throw new IOException(
"image '"+
skinSource.
getURI(filename)+
"' does not exist");
109 throw new AssertionError(ex);
final JXCSkinSource skinSource
The JXCSkinSource for loading resources.
String getURI(@NotNull String name)
Returns a description of the location of a resource name.
Creates BufferedImage instances from string representations.
BufferedImage getImage(@NotNull final String name)
Loads an image by base file name.
T lookup(@NotNull final String name)
Looks up an element by name.
void clear()
Forgets all cached elements.
Implements a cache for elements identified by name.
Exception thrown if a skin related problem occurs.
Interface for providers of JXCSkin sources.
ImageParser(@NotNull final JXCSkinSource skinSource)
Creates a new instance.
void insert(@NotNull final String name, @NotNull final T t)
Adds a new element to the cache.
Image getImage(@Nullable final Color color, @NotNull final String name)
Optionally loads an image by base file name.
final JXCSkinCache< BufferedImage > definedImages
All defined images.
void clear()
Forgets all defined images.
InputStream getInputStream(@NotNull String name)
Returns an InputStream for a resource name.