我正在尝试使用Canvas
. 我试过用Path
画直线 然后arcTo()
,但我不知道我应该使用哪些值。如何绘制与图像中的形状相似的形状?
编辑:这段代码不起作用,它画一条直线。
Path path = new Path();
path.moveTo(width/2-10, (height/2)+130);
path.lineTo(width/2-12, (height/2)+170);
float x1 = width/2-12; //228
float y1 = height/2+170; //570
float x3 = width/2-70; //170
float y3 = height/2+140; //540
float x2 = (x3+x1)/2; //199
float y2 = (y3+y1)/2; //555
path.quadTo(x1, y1, x2, y2);
Paint paint = new Paint()
{
{
setStyle(Paint.Style.STROKE);
setColor(Color.YELLOW);
setStrokeCap(Paint.Cap.ROUND);
setStrokeWidth(3.0f);
setAntiAlias(true);
}
};
mCanvas.drawPath(path, paint);