Search in sources :

Example 1 with FileTextureData

use of com.badlogic.gdx.graphics.glutils.FileTextureData in project libgdx by libgdx.

the class TextureAtlasPanel method setAtlas.

public void setAtlas(TextureAtlas atlas) {
    if (atlas == this.atlas)
        return;
    regionsPanel.removeAll();
    Array<AtlasRegion> atlasRegions = atlas.getRegions();
    CustomCardLayout layout = (CustomCardLayout) regionsPanel.getLayout();
    Array<TextureRegion> regions = new Array<TextureRegion>();
    for (Texture texture : atlas.getTextures()) {
        FileTextureData file = (FileTextureData) texture.getTextureData();
        regionsPanel.add(new TexturePanel(texture, getRegions(texture, atlasRegions, regions)));
    }
    layout.first(regionsPanel);
    this.atlas = atlas;
}
Also used : Array(com.badlogic.gdx.utils.Array) TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) AtlasRegion(com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion) FileTextureData(com.badlogic.gdx.graphics.glutils.FileTextureData) Texture(com.badlogic.gdx.graphics.Texture)

Example 2 with FileTextureData

use of com.badlogic.gdx.graphics.glutils.FileTextureData in project libgdx by libgdx.

the class TexturePanel method setTexture.

public void setTexture(Texture texture) {
    if (this.texture == texture)
        return;
    this.texture = texture;
    FileTextureData data = (FileTextureData) texture.getTextureData();
    setImage(data.getFileHandle().file().getAbsolutePath());
}
Also used : FileTextureData(com.badlogic.gdx.graphics.glutils.FileTextureData)

Example 3 with FileTextureData

use of com.badlogic.gdx.graphics.glutils.FileTextureData in project libgdx by libgdx.

the class TextureDataTest method create.

public void create() {
    spriteBatch = new SpriteBatch();
    // texture = new Texture(new PixmapTextureData(new Pixmap(Gdx.files.internal("data/t8890.png")), null, false, true));
    texture = new Texture(new FileTextureData(Gdx.files.internal("data/t8890.png"), null, null, false));
}
Also used : FileTextureData(com.badlogic.gdx.graphics.glutils.FileTextureData) SpriteBatch(com.badlogic.gdx.graphics.g2d.SpriteBatch) Texture(com.badlogic.gdx.graphics.Texture)

Example 4 with FileTextureData

use of com.badlogic.gdx.graphics.glutils.FileTextureData in project commons-gdx by gemserk.

the class GpuMemUtils method getFilePath.

private static String getFilePath(Texture texture) {
    String path = null;
    TextureData textureData = texture.getTextureData();
    if (textureData instanceof FileTextureData) {
        FileTextureData fileTextureData = (FileTextureData) textureData;
        path = fileTextureData.getFileHandle().path();
    }
    return path;
}
Also used : FileTextureData(com.badlogic.gdx.graphics.glutils.FileTextureData) TextureData(com.badlogic.gdx.graphics.TextureData) FileTextureData(com.badlogic.gdx.graphics.glutils.FileTextureData)

Example 5 with FileTextureData

use of com.badlogic.gdx.graphics.glutils.FileTextureData in project libgdx by libgdx.

the class GWTLossyPremultipliedAlphaTest method create.

public void create() {
    batch = new SpriteBatch();
    // Load a texture with premultiplied alpha
    FileTextureData data = new FileTextureData(Gdx.files.internal("data/premultiplied_alpha_test.png"), null, null, false);
    goodTexture = new Texture(data);
    // Load the texture again. But this time, force the GWT implementation of Pixmap to move to a Canvas representation of the image
    Pixmap pixmap = new Pixmap(Gdx.files.internal("data/premultiplied_alpha_test.png"));
    pixmap.getPixel(0, 0);
    FileTextureData data1 = new FileTextureData(null, pixmap, null, false);
    badTexture = new Texture(data1);
}
Also used : FileTextureData(com.badlogic.gdx.graphics.glutils.FileTextureData) SpriteBatch(com.badlogic.gdx.graphics.g2d.SpriteBatch) Texture(com.badlogic.gdx.graphics.Texture) Pixmap(com.badlogic.gdx.graphics.Pixmap)

Aggregations

FileTextureData (com.badlogic.gdx.graphics.glutils.FileTextureData)5 Texture (com.badlogic.gdx.graphics.Texture)3 SpriteBatch (com.badlogic.gdx.graphics.g2d.SpriteBatch)2 Pixmap (com.badlogic.gdx.graphics.Pixmap)1 TextureData (com.badlogic.gdx.graphics.TextureData)1 AtlasRegion (com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion)1 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)1 Array (com.badlogic.gdx.utils.Array)1