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

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

Introduction

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

Prototype

public void dispose() 

Source Link

Usage

From source file:me.scarlet.undertailor.gfx.spritesheet.PackagedSpriteSheetFactory.java

License:Open Source License

@Override
protected CompletableFuture<Texture> loadDisposable() {
    InputStream textureStream = null;
    try { // load the spritesheet here
        textureStream = sourceFile.getInputStream(sourceFile.getEntry(ENTRY_SPRITESHEET));
        Gdx2DPixmap readMap = new Gdx2DPixmap(textureStream, Gdx2DPixmap.GDX2D_FORMAT_RGBA8888);
        Texture texture = new Texture(new Pixmap(readMap));
        readMap.dispose();

        this.loadSheet(texture);

        return CompletableFuture.completedFuture(texture);
    } catch (Exception e) {
        log.error("Failed to load packaged spritesheet", e);
    } finally {/*from  ww w. jav a  2 s.c  o  m*/
        StreamUtil.closeQuietly(textureStream);
    }

    return null;
}