overlay Bitmaps - Android Graphics

Android examples for Graphics:Bitmap Combine

Description

overlay Bitmaps

Demo Code


//package com.java2s;

import android.graphics.*;

public class Main {
    public static Bitmap overlayBitmaps(Bitmap bmpBelow, Bitmap bmpAbove) {
        Bitmap bitmapOverlay = Bitmap.createBitmap(bmpBelow.getWidth(),
                bmpBelow.getHeight(), bmpBelow.getConfig());
        Canvas canvas = new Canvas(bitmapOverlay);
        canvas.drawBitmap(bmpBelow, new Matrix(), null);
        int floatImageSize = (bmpBelow.getWidth() - bmpAbove.getWidth()) / 2;
        canvas.drawBitmap(bmpAbove, floatImageSize, floatImageSize, null);
        return bitmapOverlay;
    }/* w w  w  . j  av a2 s  . co m*/
}

Related Tutorials