Example usage for com.badlogic.gdx.graphics.g2d Gdx2DPixmap Gdx2DPixmap

List of usage examples for com.badlogic.gdx.graphics.g2d Gdx2DPixmap Gdx2DPixmap

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics.g2d Gdx2DPixmap Gdx2DPixmap.

Prototype

public Gdx2DPixmap(byte[] encodedData, int offset, int len, int requestedFormat) throws IOException 

Source Link

Usage

From source file:com.md.crypto.PixmapCrypto.java

License:Apache License

/**
 * Creates a new Pixmap instance from the given encoded image data. The
 * image can be encoded as JPEG, PNG or BMP.
 * //from   w  w  w.  j  a va 2 s  . c  o  m
 * @param encodedData
 *            the encoded image data
 * @param offset
 *            the offset
 * @param len
 *            the length
 */
public PixmapCrypto(byte[] encodedData, int offset, int len) {
    try {
        pixmap = new Gdx2DPixmap(encodedData, offset, len, 0);
    } catch (IOException e) {
        throw new GdxRuntimeException("Couldn't load pixmap from image data", e);
    }
}

From source file:com.md.crypto.PixmapCrypto.java

License:Apache License

/**
 * Creates a new Pixmap instance from the given file. The file must be a
 * Png, Jpeg or Bitmap. Paletted formats are not supported.
 * /*from   w w  w.  j  a v a 2  s .c  o  m*/
 * @param file
 *            the {@link FileHandle}
 */
public PixmapCrypto(FileHandle file) {
    try {
        byte[] bytes = file.readBytes();
        long currentTime = System.currentTimeMillis();
        //         XorEncrypto.encrypt(bytes, 10);
        //         XorEncrypto.decryp(bytes, 10);
        XXTEACrypto.encrypt(bytes, Config.keysEn);
        XXTEACrypto.decrypt(bytes, Config.keysDe);
        System.out.println("timeDE: " + (System.currentTimeMillis() - currentTime));
        pixmap = new Gdx2DPixmap(bytes, 0, bytes.length, 0);
    } catch (Exception e) {
        throw new GdxRuntimeException("Couldn't load file: " + file, e);
    }
}