Here you can find the source of combineImages(Bitmap c, Bitmap s)
Parameter | Description |
---|---|
c | the c |
s | the s |
public static Bitmap combineImages(Bitmap c, Bitmap s)
//package com.java2s; import android.graphics.Bitmap; import android.graphics.Canvas; public class Main { /**//w w w. j a va 2s . com * Combine bitmap images. * * @param c * the c * @param s * the s * @return the bitmap * @author siddhesh */ public static Bitmap combineImages(Bitmap c, Bitmap s) { // can add a 3rd // parameter // 'String loc' // if you want // to save the // new image - // left some // code to do // that at the // bottom Bitmap cs = null; /* * int width, height = 0; * * if(c.getWidth() > s.getWidth()) { width = c.getWidth() + * s.getWidth(); height = c.getHeight(); } else { width = s.getWidth() + * s.getWidth(); height = c.getHeight(); } */ cs = Bitmap.createBitmap(c, 0, 0, c.getWidth(), c.getHeight()); Canvas comboImage = new Canvas(cs); // comboImage.drawBitmap(c, 0f, 0f, null); comboImage.drawBitmap(s, 0f, 0f, null); // this is an extra bit I added, just incase you want to save the new // image somewhere and then return the location /* * String tmpImg = String.valueOf(System.currentTimeMillis()) + ".png"; * * OutputStream os = null; try { os = new FileOutputStream(loc + * tmpImg); cs.compress(CompressFormat.PNG, 100, os); } * catch(IOException e) { Log.e("combineImages", * "problem combining images", e); } */ return cs; } }