i have a master bitmap that i need to draw on it other bitmaps.
the master bitmap has some semi-transparent pixels (pixels with variant values for the alpha channel) , so that the other bitmaps that are drawn on it should be merged with it instead of overriding the colors completely.
how can i set the canvas to draw the bitmaps on the master bitmap with respect to the semi-transparent pixels ?
note: the alpha is not for the whole bitmap/s . it's per pixel.
Canvas.setXfermode(Xfermode xfermode)
. There are a number of Xfermode
s you can choose.
public void putOver(Bitmap master, Bitmap alphaBitmap){
Canvas canvas = new Canvas(matter);
Paint paint = new Paint();
paint.setXferMode(new PorterDuffXfermode(PorterDuff.Mode.DST_OVER));
canvas.drawBitmap(left, top, left+alphaBitmap.width, left+alphaBitmap.height, paint);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With