rewritten AbstractDrawer to use ImageStorage
This commit is contained in:
parent
a7a530a9aa
commit
47b894f99e
@ -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));
|
||||
|
||||
public AbstractDrawer(String path) throws IOException {
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user