我使用下面的代碼把兩個圖像結合起來。
Bitmap pic = BitmapFactory.decodeResource(getResources(), R.drawable.me);
Bitmap map = BitmapFactory.decodeResource(getResources(), R.drawable.static);
Canvas comboImage = new Canvas(map);
Bitmap out1 = null ;
comboImage.setBitmap(out1);
comboImage.drawBitmap(pic, 600, 350, null);
假定我可以使用 bitmap out1 獲取最後的圖像,但是 comboImage.setBitmap(out1);
這一行引發崩潰。沒有這一行不能看到任何圖像。如何獲取最後結合圖像?
Bitmap pic = BitmapFactory.decodeResource(getResources(), R.drawable.me);
Bitmap map = BitmapFactory.decodeResource(getResources(), R.drawable.static);
**Bitmap out1 = Bitmap.createBitmap(width, height, Config.ARGB_8888);;
Canvas comboImage = new Canvas(out1);
comboImage.drawBitmap(map, 0, 0, null);
comboImage.drawBitmap(pic, 600, 350, null);**