private Bitmap filterColor(Bitmap bmp,int filterColor){
Canvas c = new Canvas(bmp);
Paint p = new Paint();
p.setAlpha(0);
p.setXfermode(new AvoidXfermode(filterColor, 0, AvoidXfermode.Mode.TARGET));
c.drawPaint(p);
return bmp;
Canvas c = new Canvas(bmp);
Paint p = new Paint();
p.setAlpha(0);
p.setXfermode(new AvoidXfermode(filterColor, 0, AvoidXfermode.Mode.TARGET));
c.drawPaint(p);
return bmp;
}
有时候传来的png图片背景是有颜色的,想要处理成透明的png图片
只需要执行上面的方法