예제 #1
0
파일: Map.java 프로젝트: rossmcnulty/Maplet
 /**
  * Draws the specified image at the given coordinates.
  *
  * @param x X coordinate
  * @param y Y coordinate
  * @param image Image to draw
  */
 public void drawImage(int x, int y, Image image) {
   byte[] bytes = MapPalette.imageToBytes(image);
   int width = image.getWidth(null);
   for (int xx = 0; xx < image.getWidth(null); ++xx) {
     for (int yy = 0; yy < image.getHeight(null); ++yy) {
       setPixel(x + xx, y + yy, bytes[yy * width + xx]);
     }
   }
 }
예제 #2
0
  public FramedLetterRenderer(Courier p) {
    super(false); // Framed Letters are not contextual (i.e same for all players)
    plugin = p;

    if (clearImage == null) {
      try {
        InputStream is = plugin.getClass().getResourceAsStream("/framed.png");
        if (is != null) {
          framed = ImageIO.read(is);
          is.close();
        }
      } catch (IOException e) {
        plugin.getCConfig().clog(Level.WARNING, "Unable to find framed.png in .jar");
        e.printStackTrace();
      }
      if (framed != null) {
        plugin.getCConfig().clog(Level.FINE, "framed.png found");
        clearImage = MapPalette.imageToBytes(framed);
      } else {
        clearImage = new byte[128 * 128];
      }
    }
  }