Ejemplo n.º 1
0
  @Override
  public ILegibleImage readAsset(IAsset asset, DataInputStream in) throws Throwable {
    PNGDecoder dec = new PNGDecoder(in);

    int width = dec.getWidth();
    int height = dec.getHeight();

    ByteBuffer buf = BufferHelper.createByteBuffer(width * height * 4);

    dec.decode(buf, width * 4, PNGDecoder.Format.RGBA);

    buf.flip();

    return new LegibleByteImage(ColorFormat.RGBA, width, height, buf);
  }