翻转Android画布 [英] Flip an Android Canvas

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

问题描述

在Android中有一个简单的方法来翻转画布吗?我似乎没有找到任何东西,允许我翻转它垂直,所以在Y轴上的零是手机屏幕的底部,而不是顶部。如果解决方案不是特别快,因为我没有做任何计算强烈的画布。

Is there an easy way to flip a canvas in Android? I cant seem to find anything that allows me to flip it vertically so that zero on the y-axis is the bottom of the phone screen instead of the top. It's OK if the solution isn't especially fast because I'm not doing anything computationally intense with the canvas.

提前感谢。

推荐答案

尝试

canvas.scale(1, -1, width / 2, height / 2)

请参阅 Canvas.scale 文档。前两个参数是按比例缩放的量。

See Canvas.scale documentation. The first two parameters are the amount to scale by.

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

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