在 Android 上使用透明涂料绘图 [英] Drawing with Transparent Paint on Android
本文介绍了在 Android 上使用透明涂料绘图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我在 Android 的普通 2D 画布上使用 Paint
和 Color.TRANSPARENT
时,我没有得到任何结果,我的目的是摆脱一些画布上的内容.我的意思是我要处理的内容不会消失.
When I use Paint
with Color.TRANSPARENT
on a normal 2D canvas in Android, I don't get any results and my intention was to get rid of some of the contents on the canvas. I mean the contents that I want to dispose of don't disappear.
这是我的Paint
的代码:
mPointFillPaint = new Paint();
mPointFillPaint.setColor(Color.TRANSPARENT);
mPointFillPaint.setAntiAlias(true);
mPointFillPaint.setStyle(Paint.Style.FILL);
mPointFillPaint.setStrokeJoin(Paint.Join.MITER);
推荐答案
以下 Paint
配置应该会有所帮助:
The following Paint
configuration should help:
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mPaint.setColor(Color.TRANSPARENT);
mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OUT));
mPaint.setAntiAlias(true);
这篇关于在 Android 上使用透明涂料绘图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文