blob: f1ac85a156d0701f9fcc48194982ffc4f013a800 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
package com.android.camera.ui;
import android.graphics.Bitmap;
import android.graphics.Canvas;
/** Using a canvas to draw the texture */
public abstract class CanvasTexture extends Texture {
protected Canvas mCanvas;
public CanvasTexture(int width, int height) {
setSize(width, height);
}
@Override
protected Bitmap getBitmap() {
Bitmap bitmap = generateGLCompatibleBitmap(mWidth, mHeight);
mCanvas = new Canvas(bitmap);
onDraw(mCanvas, bitmap);
return bitmap;
}
@Override
protected void freeBitmap(Bitmap bitmap) {
bitmap.recycle();
}
abstract protected void onDraw(Canvas canvas, Bitmap backing);
}
|