垂直翻转Android画布 [英] Flip vertically an Android Canvas

查看:85
本文介绍了垂直翻转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(1f, -1f, width / 2f, height / 2f)

请参见 Canvas.scale 文档。前两个参数是要缩放的数量。

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

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

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