Android Canvas Draw add(Bitmap firstlayer, Bitmap secondlayer)

Here you can find the source of add(Bitmap firstlayer, Bitmap secondlayer)

Description

combines to Bitmap s

Parameter

Parameter Description
firstlayer a parameter
secondlayer a parameter

Return

combined bitmap

Declaration

public static Bitmap add(Bitmap firstlayer, Bitmap secondlayer) 

Method Source Code

//package com.java2s;

import android.graphics.Bitmap;
import android.graphics.Canvas;

public class Main {
    /**/* w ww.  j  a va2s . c o  m*/
     * combines to {@link Bitmap}s
     * 
     * @param firstlayer
     * @param secondlayer
     * @return combined bitmap
     */
    public static Bitmap add(Bitmap firstlayer, Bitmap secondlayer) {
        Bitmap data = Bitmap.createBitmap(secondlayer.getWidth(),
                secondlayer.getHeight(), secondlayer.getConfig());
        Canvas temp = new Canvas(data);

        temp.drawBitmap(secondlayer, 0, 0, null);
        temp.drawBitmap(firstlayer, 0, 0, null);

        return data;
    }

    /**
     * combines to {@link Bitmap}s
     * 
     * @param Images
     *        to be combine
     * @return combined bitmap
     */
    public static Bitmap add(Bitmap[] images) {
        Bitmap data = Bitmap.createBitmap(images[0].getWidth(),
                images[0].getHeight(), images[0].getConfig());
        Canvas temp = new Canvas(data);

        for (int i = 0; i < images.length; i++) {
            temp.drawBitmap(images[i], 0, 0, null);
        }

        return data;
    }
}

Related

  1. drawSelect(Bitmap bm, int x, int y, int cellWidth, int cellHeight)
  2. drawText(String strMsg, Canvas g, Paint paint, int setx, int sety, int fg, int bg)
  3. drawTextAtCanvasCenter(Canvas canvas, Paint paint, String text)
  4. circle(Canvas canvas, int color, int stroke, float x, float y, float radius)
  5. rect(Canvas canvas, int color, int stroke, float x, float y, float width, float height)
  6. add(Bitmap[] images)