Android 使用剪切路径(或任何其他方法)将位图的一部分覆盖在另一部分之上
Android 2.1 或更高版本
假设我有两个大小相同的图像,其中一个是甜甜圈形状,甜甜圈的中间和外部都是透明的。
另一个是与甜甜圈大小相同的方形图像
如果它们被覆盖,它们看起来会像这样(甜甜圈实际上是不可见的,因为正方形将位于 Z 堆栈的顶部)
我想做的是创建一个剪切路径或任何真正使用 a 来显示落在甜甜圈内的方形位图部分的方法起始角和停止角(这将随时间变化)
因此,例如显示甜甜圈内部的蓝色正方形部分,从 0 度开始到 40 度结束,以及 180 度和 270 度结束。这会产生这样的东西。
甚至不知道从哪里开始,有人有什么想法吗?
Android 2.1 or greater
Suppose I have two images that are the same size, one is a donut shape with transparency in the middle and outside the donut.
The other is a square image that is the same size as the donut
If they were overlayed they would look something like this (the donut would actually not be visible since the square would be on top of the Z stack)
What I would like to do is create a clipping path or any method really to display the portion of the square bitmap that falls inside the donut using a starting and stopping angle (which would change over time)
So for instance show the portion of blue square that is inside the donut starting at 0 degrees and ending at 40 degrees, as well as 180 and 270 degrees. Which would produce something like this.
Not even sure where to start, anyone have any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
自己没有尝试过,但 clipPath(Path path) 可能就是你的正在寻找。困难的部分是设置正确的路径来进行剪辑。
Haven't tried myself but clipPath(Path path) might be what you are looking for. The hard part would be to setup the correct path to do the clipping with.