How drag and adjust the image in a imageView of android and then mask that imageview with another image in android

  • Replies:0
Avnish Singh
  • Forum posts: 2

May 24, 2013, 11:41:32 AM via Website

How to perform an action in android according to which we can drag and adjust the image in image View of android and then apply masking to it.
Below is my code for masking an image



public void mask(Bitmap original){
Bitmap mask = BitmapFactory.decodeResource(getResources(),R.drawable.full_mask);
Bitmap result = Bitmap.createBitmap(mask.getWidth(),mask.getHeight(), Config.ARGB_8888);
Canvas mCanvas = new Canvas(result);
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
mCanvas.drawBitmap(original, 0, 0, null);
mCanvas.drawBitmap(mask, 0, 0, paint);
paint.setXfermode(null);
view.setImageBitmap(result);
//view.setScaleType(ScaleType.CENTER);
view.setBackgroundResource(R.drawable.overlay_outlines);
view.invalidate();
}


But this code is only for masking .How can i drag and adjust the image first and then perform masking on it .like mask only the human face in image .

— modified on May 24, 2013, 1:47:22 PM

Reply