我有一个自定义视图,在onDraw()中,我试图执行位图掩蔽。我有一个填充整个视图的squareBitmap (红色),还有一个充当掩码的circleBitmap (蓝色)。我使用的模式是:PorterDuff.Mode.DST_IN。
我的代码:(为了这个问题,我在onDraw()中移动了所有东西)
final i
实现transparentOverride 使掩码中的所有黑色像素都成为视图的draw函数,使用DST_IN的xfermode (PorterDuffXfermode)在原始图像上绘制掩码only let non-transparent pixels through paint.xfermodeDraw all lines point to point with white color and custom