如何合并两个位图一个比另一个位图、两个

由网友(自认与酒同醉)分享简介:我有两个图像,我想救一个位图图像在另一个完全在同一点上它是present我还用手势移动图像。I have two images and i want to save one bitmap image over another exactly at the same point where it is present...

我有两个图像,我想救一个位图图像在另一个完全在同一点上它是present我还用手势移动图像。

I have two images and i want to save one bitmap image over another exactly at the same point where it is present i also move image using gesture .

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;
    }

任何帮助将是很大的AP preciated。

Any help would be greatly appreciated.

推荐答案

您可以将两个位图这样的

you can combine two bitmaps like this

public static Bitmap overlay(Bitmap bmp1, Bitmap bmp2) {
    Bitmap bmOverlay = Bitmap.createBitmap(bmp1.getWidth(), bmp1.getHeight(), bmp1.getConfig());
    Canvas canvas = new Canvas(bmOverlay);
    canvas.drawBitmap(bmp1, new Matrix(), null);
    canvas.drawBitmap(bmp2, 0, 0, null);
    return bmOverlay;
}
阅读全文

相关推荐

最新文章