示例#1
0
 /**
  * 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];
      }
    }
  }