Paint paint = new Paint();
//paint.setColor(0x00000000);
paint.setShadowLayer(10, 0, 0, Color.BLACK);
Rect rect = new Rect(0, 0, 100, 100);
canvas.drawRect(rect, paint);
Paint paint = new Paint();
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
Rect rect = new Rect(left, top, right, bottom);
canvas.drawRect(rect, paint);
1条答案
按热度按时间cgyqldqp1#
我最后创造了第二个
Canvas
等一下Bitmap
然后在我剪下一些部分后把它们合并起来PorterDuff.Mode.CLEAR
. 这样我就可以像在图像编辑应用程序中那样创建层,并且不会丢失背景。我就是这样切零件的:
我就是这样把这些层重新组合起来的: