List of usage examples for com.badlogic.gdx.graphics TextureData isPrepared
public boolean isPrepared();
From source file:com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.java
License:Open Source License
public static int pick(int index, int x, int y) { GdxTexture bmp = TextureCache.get(Assets.ITEMS).bitmap; int rows = bmp.getWidth() / SIZE; int row = index / rows; int col = index % rows; // FIXME: I'm assuming this is super slow? final TextureData td = bmp.getTextureData(); if (!td.isPrepared()) { td.prepare();//w ww . j a v a2 s .c o m } final Pixmap pixmap = td.consumePixmap(); int pixel = pixmap.getPixel(col * SIZE + x, row * SIZE + y); pixmap.dispose(); return pixel; }
From source file:com.watabou.noosa.particles.BitmaskEmitter.java
License:Open Source License
public BitmaskEmitter(Image target) { super();/* ww w . j a va 2 s . co m*/ this.target = target; TextureData data = target.texture.bitmap.getTextureData(); if (!data.isPrepared()) data.prepare(); map = data.consumePixmap(); mapW = map.getWidth(); mapH = map.getHeight(); }