Android反向剪辑 [英] Android inverse clip

查看:99
本文介绍了Android反向剪辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要指定一个不能在其中绘制Android画布的矩形.我知道clipRect将指定绘制区域和绘制区域,但是我想是否可以扭转这种影响.换句话说,如何绘制对象使其绘制到矩形的外部.图片说明:

I need to specify a rectangle in which the Android canvas CANNOT draw inside of. I know that clipRect will specify and area in which to draw in, but I was if I could reverse this effect. In other words how do I draw an object making it draw to the outside of a rectangle. Image for clarification:

推荐答案

我不确定这是否真的比透支要好.但是您可以将剪切路径设置为全视图,然后将第二个剪切路径设置为具有Region.Op DIFFERENCE的排除区域.这样会将裁剪矩形设置为两者之间的差异.

I'm not sure if this is actually going to be more performant than doing an overdraw. But you could set a clipping path to the full view, then set a second one to the exclusion zone with Region.Op DIFFERENCE set. That would set the clipping rect to the difference between the two.

这篇关于Android反向剪辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆