EOS 2  1.1.0
Einfache Objektbasierte Sprache
Image.java
gehe zur Dokumentation dieser Datei
1 package de.lathanda.eos.base;
2 
3 import java.awt.image.BufferedImage;
4 import java.io.BufferedInputStream;
5 import java.io.IOException;
6 
7 import javax.imageio.ImageIO;
13 public class Image {
14  private BufferedImage image;
15  private int imageX;
16  private int imageY;
17  private int imageWidth;
18  private int imageHeight;
19 
20  public Image(String source) {
21  try (BufferedInputStream bi = new BufferedInputStream(ResourceLoader.getResourceAsStream(source))){
22  image = ImageIO.read(bi);
23  } catch (IOException fnfe) {
24  image = null;
25  return;
26  }
27  this.imageX = 0;
28  this.imageY = 0;
29  this.imageWidth = image.getWidth();
30  this.imageHeight = image.getHeight();
31  }
32 
33  public Image(BufferedImage image, int imageX, int imageY, int imageWidth, int imageHeight) {
34  super();
35  this.image = image;
36  this.imageX = imageX;
37  this.imageY = imageY;
38  this.imageWidth = imageWidth;
39  this.imageHeight = imageHeight;
40  }
41 
42  protected BufferedImage getImage() {
43  return image;
44  }
45  protected int getImageX() {
46  return imageX;
47  }
48 
49  public int getImageY() {
50  return imageY;
51  }
52 
53  public int getImageWidth() {
54  return imageWidth;
55  }
56 
57  public int getImageHeight() {
58  return imageHeight;
59  }
60 
61 }
Image(BufferedImage image, int imageX, int imageY, int imageWidth, int imageHeight)
Definition: Image.java:33
BufferedImage getImage()
Definition: Image.java:42
Image(String source)
Definition: Image.java:20
static InputStream getResourceAsStream(String filename)
Impressum