示例#1
0
  Images(String fileName) {
    File thisF = new File(fileName);

    InputStream thisStream = this.getClass().getClassLoader().getResourceAsStream(fileName);
    try {
      image = ImageIO.read(thisStream);
    } catch (Exception e) {;
    }
    if (image != null) {
      BufferedImage bi = Calc.newBImage(image.getWidth(), image.getHeight());
      bi.getGraphics().drawImage(image, 0, 0, null);
      image = bi;
    }
  }
示例#2
0
 public BufferedImage[] readImages(String baseName) {
   int n = 1;
   String urlString = "Images/" + baseName + n + ".png";
   InputStream thisStream = this.getClass().getClassLoader().getResourceAsStream(urlString);
   ArrayList<BufferedImage> temp = new ArrayList<BufferedImage>();
   BufferedImage image = null;
   while (thisStream != null) {
     try {
       image = ImageIO.read(thisStream);
     } catch (Exception e) {;
     }
     if (image != null) {
       BufferedImage bi = Calc.newBImage(image.getWidth(), image.getHeight());
       bi.getGraphics().drawImage(image, 0, 0, null);
       image = bi;
     }
     temp.add(image);
     n++;
     urlString = "Images/" + baseName + n + ".png";
     thisStream = this.getClass().getClassLoader().getResourceAsStream(urlString);
   }
   return temp.toArray(new BufferedImage[] {});
 }