我要将存在data对象里的2000个点要画在屏幕上
Bitmap bitmap = Bitmap.createBitmap(2000,100,Config.ARGB_8888);
Canvas canvasTemp=new Canvas(bitmap);
Paint paint=new Paint();
for (int i = 0; i < 2000; i++) {
canvasTemp.drawPoint(i, data.getData(i), paint);
}
Matrix matrix = new Matrix();
float scaleWidth = ((float) 640 / 2000);
float scaleHeight = ((float) 480/ 100);
matrix.postScale(scaleWidth, scaleHeight);
Bitmap newbmp = Bitmap.createBitmap(bitmap, 0, 0,2000, 100, matrix, true);
canvas.drawBitmap(newbmp, 0, 0, new Paint());
这样画图速度太慢了,大概需要5,6秒。怎么可以让画图速度快些,谢谢
画图速度;Canvas
------解决方案--------------------
自己开辟一块内存先把点画在内存里,再贴到屏幕buffer上。
------解决方案--------------------
直接在canvas中画图,就不用创建两个 bitmaps:
Paint paint=new Paint();
Matrix matrix = new Matrix();
float scaleWidth = ((float) 640 / 2000);
float scaleHeight = ((float) 480/ 100);
matrix.postScale(scaleWidth, scaleHeight);
canvast.concat(matrix);
for (int i = 0; i < 2000; i++) {
canvas.drawPoint(i, data.getData(i), paint);
}