定义一个接口
package com.badlogic.androidgames.framework;
import com.badlogic.androidgames.framework.Graphics.PixmapFormat;
public interface Pixmap {
public int getWidth();
public int getHeight();
public PixmapFormat getFormat();
public void dispose();
}
接口实现
package com.badlogic.androidgames.framework.impl;
import android.graphics.Bitmap;
import com.badlogic.androidgames.framework.Graphics.PixmapFormat;
import com.badlogic.androidgames.framework.Pixmap;
public class AndroidPixmap implements Pixmap {
Bitmap bitmap;
PixmapFormat format;
public AndroidPixmap(Bitmap bitmap, PixmapFormat format) {
this.bitmap = bitmap;
this.format = format;
}
public int getWidth() {
return bitmap.getWidth();
}
public int getHeight() {
return bitmap.getHeight();
}
public PixmapFormat getFormat() {
return format;
}
public void dispose() {
bitmap.recycle();
}
}