1
我想將兩個位圖並排合併到一個位圖中。以下代碼是合併子底部。如何並行合併到一個位圖中?如何並列合併位圖
public Bitmap mergeBitmap(Bitmap fr, Bitmap sc)
{
Bitmap comboBitmap;
int width, height;
width = fr.getWidth() + sc.getWidth();
height = fr.getHeight();
comboBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas comboImage = new Canvas(comboBitmap);
comboImage.drawBitmap(fr, 0f, 0f, null);
comboImage.drawBitmap(sc, 0f , fr.getHeight(), null);
return comboBitmap;
}
改用x -coordinate; ''comboImage.drawBitmap(sc,fr.getWidth(),0f,null)''。 – harism
不幸的是,我在屏幕上看到「fr」。 sc從screeen溢出 – NabukkadNezzar
我覺得,問題是canvas功能。代碼的第一個狀態是 width = fr.getWidth();代碼的第一個狀態是 width = fr.getWidth(); height = fr.getHeight()+ sc.getWidth(); 我改變了之後; width = fr.getWidth()+ sc.getWidth(); height = fr.getHeight(); – NabukkadNezzar