简体   繁体   English

如何在画布上使用屏幕坐标进行绘制?

[英]How do I draw with the screen coordinates on canvas?

As is known, drawCircle(x, y, radius, paint); 众所周知, drawCircle(x, y, radius, paint); takes in the canvas coordinates, which may be different from the screen coordinates. 接受画布坐标,该坐标可能与屏幕坐标不同。

So if I just want to draw something on one particular point on the screen, how would I do that with that method? 因此,如果我只想在屏幕上的一个特定点上绘制某些东西,该如何使用该方法呢?

I am asking this because the canvas may be moved or even zoomed, but I do NOT wish my circle to move. 我问这个问题是因为画布可能会移动甚至放大,但是我不希望我的圈子移动。 I want it to stay at that particular point on screen. 我希望它停留在屏幕上的特定位置。

Here is the description of drawCircle() method. drawCircle()方法的描述。

It seems that there are no direct converting methods. 似乎没有直接转换方法。

We have to convert it manually by the help of maths. 我们必须借助数学手动将其转换。

We can process the coordinates according to the properties, like translation or scaling or even rotation. 我们可以根据属性来处理坐标,例如平移或缩放甚至旋转。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM