安卓:寻找drawArc()方法,内部和放大器;外径外径、放大器、方法、drawArc

2023-09-07 12:16:02 作者:失心不失稳

我有以下的自定义视图:

I have the following custom view:

这个我已经使用Canvas的 drawArc()方法来实现。然而,与此 drawArc()方法,我不能限制弧的内径。

This I have achieved by using the Canvas' drawArc() method. However, with this drawArc() method I cannot limit the arc's inner radius.

我想有是这样的:

,其中仅存在一个外环左

where there is only an outer ring left.

我需要的是一个 drawArc()功能,我可以设定圆弧的内径。任何一个知道如何做到这一点?

What I need is an drawArc() function where I can set the inner radius of the arc. Anyone an idea how to do that?

(顺便说一句,overpainting内部区域不画了红色和蓝色锥体后的工作,因为它需要是透明的。绘画与 Col​​or.TRANSPARENT 的内圆不会删除旧的颜色。它只是把另一层之上,它是透明的,通过它我仍然可以看到红色和蓝色)

(BTW, overpainting the inner area doesn't work, because it needs to be transparent. Painting an inner circle with Color.TRANSPARENT after painting the red and blue cones doesn't remove the old color. It just puts another layer on top, which is transparent and through which I can still see the red and blue)

推荐答案

您可以使用PorterDuff xfermode称为内部区域画在清除。这将删除像素。

You can paint over the inner area using the PorterDuff xfermode called "Clear." This will erase pixels.