Well, it looks like you're setting every pixel on the bitmap on every frame.
Android is not a PC, it's equivalent to a 10-15 year old pc, you'll
have to optimize your code.

You can try drawing directly to the canvas, instead of drawing to a
bitmap, and then drawing that bitmap onto the canvas.
Watch this:
http://code.google.com/events/io/2009/sessions/WritingRealTimeGamesAndroid.html
and then download things like this:
http://code.google.com/p/apps-for-android/source/browse/trunk/#trunk/SpriteMethodTest
and this to see how it's done in production:
http://replicaisland.net/ (it's an open source 2d game)

On Sat, Jun 19, 2010 at 6:45 AM, qute <rosen...@gmail.com> wrote:
> 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+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en



-- 
http://diastrofunk.com, http://developingthedream.blogspot.com/,
http://www.youtube.com/user/revoltingx, ~Isaiah 55:8-9

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to