Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.graphics.Bitmap;

import android.graphics.Canvas;
import android.graphics.Matrix;

public class Main {
    public static Bitmap overlayToDownCenter(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);
        Matrix matrix = new Matrix();
        matrix.setTranslate(((float) bmp1.getWidth() - bmp2.getWidth()) / 2, bmp1.getHeight() - bmp2.getHeight());
        canvas.drawBitmap(bmp2, matrix, null);
        return bmOverlay;
    }
}