Methods Summary |
---|
public void | draw(GLCanvas canvas, int x, int y)
canvas.drawTexture(this, x, y, getWidth(), getHeight());
|
public void | draw(GLCanvas canvas, int x, int y, int w, int h)
canvas.drawTexture(this, x, y, w, h);
|
protected void | finalize()
sInFinalizer.set(BasicTexture.class);
recycle();
sInFinalizer.set(null);
|
private void | freeResource()
GLCanvas canvas = mCanvasRef;
if (canvas != null && mId != -1) {
canvas.unloadTexture(this);
mId = -1; // Don't free it again.
}
mState = STATE_UNLOADED;
setAssociatedCanvas(null);
|
public int | getHeight()
return mHeight;
|
public int | getId()
return mId;
|
protected abstract int | getTarget()
|
public int | getTextureHeight()
return mTextureHeight;
|
public int | getTextureWidth()
return mTextureWidth;
|
public int | getWidth()
return mWidth;
|
public boolean | hasBorder()
return mHasBorder;
|
public static boolean | inFinalizer()
return sInFinalizer.get() != null;
|
public static void | invalidateAllTextures()
synchronized (sAllTextures) {
for (BasicTexture t : sAllTextures.keySet()) {
t.mState = STATE_UNLOADED;
t.setAssociatedCanvas(null);
}
}
|
public boolean | isFlippedVertically()
return false;
|
public boolean | isLoaded()
return mState == STATE_LOADED;
|
protected abstract boolean | onBind(GLCanvas canvas)
|
public void | recycle()
freeResource();
|
protected void | setAssociatedCanvas(GLCanvas canvas)
mCanvasRef = canvas;
|
protected void | setBorder(boolean hasBorder)
mHasBorder = hasBorder;
|
public void | setSize(int width, int height)Sets the content size of this texture. In OpenGL, the actual texture
size must be of power of 2, the size of the content may be smaller.
mWidth = width;
mHeight = height;
mTextureWidth = width > 0 ? Utils.nextPowerOf2(width) : 0;
mTextureHeight = height > 0 ? Utils.nextPowerOf2(height) : 0;
if (mTextureWidth > MAX_TEXTURE_SIZE || mTextureHeight > MAX_TEXTURE_SIZE) {
Log.w(TAG, String.format("texture is too large: %d x %d",
mTextureWidth, mTextureHeight), new Exception());
}
|
public void | yield()
freeResource();
|
public static void | yieldAllTextures()
synchronized (sAllTextures) {
for (BasicTexture t : sAllTextures.keySet()) {
t.yield();
}
}
|