如何在影像圈的边缘画点的图像图像、影像、边缘、如何在

2023-09-06 02:11:55 作者:独羁

我真的很憋屈如何去规划这一点。如何绘制 Android的画布的圆的半径和周围的边缘点?

I'm really stuck on how to go about programming this. How to draw a circle in Android Canvas with a radius and points around the edge?

什么是设计这个最好的方法?

What is best approach to design this?

推荐答案

好;画一个圆是一个非常简单的,在你的的OnDraw()方法添加这行

Well; drawing a circle is a very straightforward, inside your onDraw() method add this line

canvas.drawCircle(cX, cY, radius, paint); 

只需提供中心点的x和y的值和半径和油漆的对象也是如此。

Simply provide the center point's x and y values and radius and paint object as well.

而对于即将来临的引脚可以是这样的, 例如你想有一个引脚为30度;用一个简单的三角计算,你的销的x和y值可在这些

And for the pins around the corner you can go like this, e.g you want a pin at 30 degrees; with a simple trigonometric calculation, your pin's x and y values can be these;

pX= mX + radius * cos(30);
pY= mY + radius * sin(30);

所以,你可以分别画出你的脚这些x和y的值,也程度是可以改变的。

So you can draw your pin at these x and y values respectively, also the degree can be changed.