如何以编程方式将两个位图合并到另一个位图?

时间:2016-11-11 10:56:23

标签: android

我试过这个

public Bitmap combineImages(Bitmap ScaledBitmap, Bitmap bit) {

    int X = bit.getWidth();
    int Y = bit.getHeight();

    Scaled_X = ScaledBitmap.getWidth();
    scaled_Y = ScaledBitmap.getHeight();

    System.out.println("Combined Images");

    System.out.println("Bit :" + X + "/t" + Y);

    System.out.println("SCaled_Bitmap :" + Scaled_X + "\t" + scaled_Y);

    overlaybitmap = Bitmap.createBitmap(ScaledBitmap.getWidth(),
            ScaledBitmap.getHeight(), ScaledBitmap.getConfig());
    Canvas canvas = new Canvas(overlaybitmap);
    canvas.drawBitmap(ScaledBitmap, new Matrix(), null);
    canvas.drawBitmap(bit, new Matrix(), null);

    return overlaybitmap;
}

它不起作用

1 个答案:

答案 0 :(得分:2)

尝试此代码片段并根据您的要求进行调整

@array("
student=Amit {
Age=20
sex=male
rollno=201
}
student=Akshaya {
Age=24
phone:88665544
sex=female
rollno=407
}

student=Akash {
Age=23
sex=male
rollno=356
address=na
phone=88456789
}
");

确保bmp1大于bmp2