I have this code that I call on each touch event that render an alpha masked bitmap:
…
Canvas canvas = new Canvas();
Bitmap bleed = BitmapFactory.decodeResource(resources, R.drawable.bleed);
Bitmap photoBG = BitmapFactory.decodeResource(resources, R.drawable.photo_bg);
Bitmap mask = BitmapFactory.decodeResource(resources, R.drawable.mask);
Bitmap result = Bitmap.createBitmap(bleed.getWidth(), bleed.getHeight(), Bitmap.Config.ARGB_8888);
canvas.setBitmap(result);
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setAntiAlias(true);
paint.setFilterBitmap(true);
paint.setDither(true);
canvas.drawBitmap(photoBG, 0, 0, paint);
canvas.drawBitmap(selectedImage, matrix, paint);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
canvas.drawBitmap(mask, 0, 0, paint);
paint.setXfermode(null);
canvas.drawBitmap(bleed, 0, 0, paint);
myImageView.setImageBitmap(result);
bleed.recycle();
mask.recycle();
img.invalidate();
}
…
The result image is ok but when I drag the image around, the performance is really slow, I’ve attached an explanatory image and my app screen capture (Note: the background is gray at the app).

Should I stick to this code (drawing on a canvas) or is there a better way achieving my goal?
You are creating 4 bitmaps on every touch, that’s your performance issue. These are very expensive calls (especially the decode*() calls.) Create/load the btimaps only once 🙂