开发者

Android: Canvas made out of multiple images won't save

Right my title isn't the best in the world. I've got a big code that's supposed to make on big bitmap out of multiple bitmaps. I've isolated the problem to this part of the code

bity = Bitmap.createBitmap(specialWidth,specialHeight,Bitmap.Config.ALPHA_8);
Canvas canvas = new Canvas(bity);

float left=0.0f;
for (int i = 0; i < imagesArrayz.length; i++开发者_如何学Go){

     float top=0.0f;        
     canvas.drawBitmap(imagesArrayz[i], left, top, null);
     left+=imagesArrayz[i].getWidth();
}

To explain: "bity" is a globally defined Bitmap object and it's unassigned untill this point;

imagesArrayz is an array of 5 Bitmaps that has already ben assigned and has ben assigned correctly (i tested it to see if each image is in the array)

After this i just have a function that saves the global variable bity to a file. THE PROBLEM is that instaid of saving my nicely drawn canvas it saves an empty jpg file of 0kb. Please help!


I answered my own question... Replace ALPHA_8 with ARGB_8888 and it all magically works.

Someone shoot me please...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜