安卓:绘画帆布,道尽左下角对应于(0,0)?帆布、应于

由网友(混世大魔王)分享简介:我想写一个图类,我可以在Android中使用(我知道pre-做那些存在),而是将我所有的坐标将是一个痛苦。有一个简单的方法,使屏幕坐标左下角开始?I'm trying to write a graph class I can use in Android(I'm aware pre-made ones exist),...

我想写一个图类,我可以在Android中使用(我知道pre-做那些存在),而是将我所有的坐标将是一个痛苦。有一个简单的方法,使屏幕坐标左下角开始?

I'm trying to write a graph class I can use in Android(I'm aware pre-made ones exist), but converting all of my coordinates would be a pain. Is there an easy way to make the screen coordinates start at the bottom left?

推荐答案

没有,我不知道的方式来移动 0,0 来左下方得到你所通常认为的正常的坐标。

No, I don't know of a way to move 0,0 to the bottom left and get what you would typically think of as "normal" coordinates.

但结合规模()翻译()可能做的伎俩来达到同样的效果。

But combining scale() and translate() might do the trick to achieve the same effect.

canvas.translate(0,canvas.getHeight());   // reset where 0,0 is located
canvas.scale(1,-1);    // invert
阅读全文

相关推荐

最新文章