rewritten AbstractDrawer to use ImageStorage

This commit is contained in:
Kjistóf 2016-05-14 20:48:04 +02:00
parent a7a530a9aa
commit 47b894f99e

View File

@ -1,25 +1,25 @@
package cicaprojekt;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
public abstract class AbstractDrawer implements Drawer {
private BufferedImage image;
private static ImageStorage storage;
private String filename;
public AbstractDrawer(String path) throws IOException {
image = ImageIO.read(new File(path));
storage = new ImageStorage();
filename = path;
}
public void changeImage(String path) throws IOException {
image = ImageIO.read(new File(path));
filename = path;
}
@Override
public BufferedImage getImage() {
return image;
return storage.getImage(filename);
}
}