1 package com.cooliris.media;
3 import android.graphics.Bitmap;
5 public abstract class Texture {
7 public static final int STATE_UNLOADED = 0;
8 public static final int STATE_QUEUED = 1;
9 public static final int STATE_LOADING = 2;
10 public static final int STATE_LOADED = 3;
11 public static final int STATE_ERROR = 4;
13 int mState = STATE_UNLOADED;
17 float mNormalizedWidth;
18 float mNormalizedHeight;
21 public boolean isCached() {
25 public final void clear() {
27 mState = STATE_UNLOADED;
31 mNormalizedHeight = 0;
32 if (mBitmap != null) {
38 public final boolean isLoaded() {
39 return mState == STATE_LOADED;
42 public final int getState() {
46 public final int getWidth() {
50 public final int getHeight() {
54 public final float getNormalizedWidth() {
55 return mNormalizedWidth;
58 public final float getNormalizedHeight() {
59 return mNormalizedHeight;
62 /** If this returns true, the texture will be enqueued. */
63 protected boolean shouldQueue() {
67 /** Returns a bitmap, or null if an error occurs. */
68 protected abstract Bitmap load(RenderView view);
70 public boolean isUncachedVideo() {