Saturday, June 19, 2010

[android-developers] Fast screen update

Hi

I'm new to this android development.
I've read a lot on the net how to do it, but I can't get the speed I
want/expect.


In init:
bitmap = Bitmap.createBitmap(WIDTH, HEIGHT, Bitmap.Config.ARGB_8888);

my onDraw method:
protected void onDraw(Canvas canvas) {

for (int j = 0; j < HEIGHT-2; j++) {
int heat = 0;
for (int i = 0; i < WIDTH; i++) {
heat = firebuf[j][i];
bitmap.setPixel(i, j, palbuf[heat]);
}
}

canvas.drawBitmap(bitmap, 0, 0, null);

// refresh the canvas
invalidate();
}

Is this the way to do it?
I come from the PC world, where I would have 2 buffers directly to the
gfx card. Write in one while the other is shown and then switch.
Couldn't find out how to do it on the android.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment