1

I want to merge two images in Android. The image shows my requirement. I know how to combine image, I am using the following codeenter image description here

public Bitmap combineImages()
    {
        Bitmap mask = getDrawingCache();
        Bitmap my_image = ((PlanetJill) mContext).my_image.getBitmap();
        Bitmap result = Bitmap.createBitmap(mask.getWidth(), mask.getHeight(), Config.ARGB_8888);
        Canvas c = new Canvas(result);
        Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
        paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER));
        c.drawBitmap(my_image, ((PlanetJill) mContext).my_image.getMatrix(), null);
        c.drawBitmap(mask, 0, 0, paint);
        paint.setXfermode(null);
        return result;
    }

I am just not sure which Xfermode to use. Could anyone please tell me what is the solution? Also if required I can change the mask too, I mean the first image can be changed such that centre square is transparent and the other area is black. If any solution is possible with either of the masks then please help.

Antrromet
  • 15,294
  • 10
  • 60
  • 75
  • 1
    try this link will help you : http://stackoverflow.com/questions/12614542/maskingcrop-image-in-frame – J.D. Oct 23 '12 at 10:35

0 Answers0