I have bitmap on which I am applying two masks. When I apply mask on the right side of bitmap, it works fine but after that when I apply mask on the bottom side of the same bitmap, I have an area on bitmap that reappear again due to remasking. I have tried to explain this issue using pic below. The area circled is causing problem. I want that area remains transparent even after remasking.
Here are my masking functions code snipped.
paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
.......
public void setRightMask(MyBitmap bmp, Type type) {
int maskIndex = -1;
switch(type){
case CONCAVE:
maskIndex = 0;
break;
case CONVEX:
maskIndex = 6;
break;
}
Bitmap result = Bitmap.createBitmap((int)bmp.getWidth(), (int)bmp.getHeight(), Config.ARGB_8888);
Canvas canvas = new Canvas(result);
canvas.drawBitmap(bmp.getBmp(), 0, 0, null);
canvas.drawBitmap(masks[maskIndex].getBmp(), bmp.getWidth() - masks[maskIndex].getBmp().getWidth(), 0, paint);
bmp.setBmp(result);
}
public void setBottomMask(MyBitmap bmp, Type type) {
int maskIndex = -1;
switch(type){
case CONCAVE:
maskIndex = 1;
break;
case CONVEX:
maskIndex = 7;
break;
}
Bitmap result = Bitmap.createBitmap((int)bmp.getWidth(), (int)bmp.getHeight(), Config.ARGB_8888);
Canvas canvas = new Canvas(result);
canvas.drawBitmap(bmp.getBmp(), 0, 0, null);
canvas.drawBitmap(masks[maskIndex].getBmp(), 0, bmp.getHeight() - masks[maskIndex].getBmp().getHeight(), paint);
bmp.setBmp(result);
}