我可以得出一个Android画布的边界之外 [英] Can I draw outside the bounds of an Android Canvas
本文介绍了我可以得出一个Android画布的边界之外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我移植写在允许拉发生剪切矩形的边界之外的图形环境的应用程序。没有办法做到这在Android中?
I'm porting an app written in a graphics environment that allows drawing to happen outside the bounds of the clipping rectangle. Any way to do this in Android?
推荐答案
要绘制的边界之外,则需要扩展画布的CLI $ P $厘。
To draw outside the bounds, you need to expand the clipRect of the canvas.
退房超载CLI preCT方式对Canvas类。
Check out the overloaded clipRect methods on the Canvas class.
请注意 - 您将需要指定的区域操作,因为默认操作是相交。因此,像这样:
Note - You will need to specify the Region operation because the default operation is INTERSECT. So something like this:
Rect newRect = canvas.getClipBounds();
newRect.inset(-5, -5) //make the rect larger
canvas.clipRect (newRect, Region.Op.REPLACE);
//happily draw outside the bound now
这篇关于我可以得出一个Android画布的边界之外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文