Creating a Bitmap from an array of Bitmaps

All your problems with Audio, Video and Images.

Creating a Bitmap from an array of Bitmaps

Postby bQt31 » Tue Aug 09, 2011 4:43 am

Hello :)

I'm a beginner and I'm trying to (see title) but I have honnestly no idea how to do it.

here is my code :

Code: Select all

public Bitmap[][] getImageNiveau()
      Bitmap[][] tableauImagesNiveau=new Bitmap[7][255];
      char[] ligneNiveau;

      for (int i=0;i<tableauNiveau.length;i++)
         ligneNiveau = tableauNiveau[i].toCharArray();
         for (int i2=0;i2<7;i2++)
            if (ligneNiveau[i2]=='r')
               tableauImagesNiveau[i2][i]=BitmapFactory.decodeResource(context.getResources(), R.drawable.road);
            else if (ligneNiveau[i2]==' ')
               tableauImagesNiveau[i2][i]=BitmapFactory.decodeResource(context.getResources(), R.drawable.noline);
            else if (ligneNiveau[i2]=='l')
               tableauImagesNiveau[i2][i]=BitmapFactory.decodeResource(context.getResources(), R.drawable.line);

What I'm trying to do is this :
|bitmap1bitmap2bitmap3bitmap4 |
|bitmap5bitmap6bitmap7bitmap8 |

where the whole thing is a new bitmap.

I need it because I have my levels in text files. Also if you have another way to do it, please contribute.
Also, will this kind of array use too much memory?

Thanks ! :mrgreen:
Posts: 3
Joined: Mon Jun 20, 2011 7:12 pm


Return to Multimedia Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 17 guests