Android 项目总结(自定义view之贝塞尔曲线与path路径)

Android 项目总结(自定义view之贝塞尔曲线与path路径)

 

public class PathView extends View {

    private Path mPath = new Path();
    private Paint mPaint = new Paint();

    public PathView(Context context) {
        super(context);
        mPaint.setColor(Color.RED);

        mPaint.setStrokeWidth(4);
        mPaint.setStyle(Paint.Style.STROKE);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
//
        mPaint.setStyle(Paint.Style.FILL);
        //一阶贝塞尔曲线,表示的是一条直线
        mPath.moveTo(100, 70); //移动
//        mPath.lineTo(140, 800);//连线
        //等同于上一行代码效果
        mPath.rLineTo(40, 730);
//        mPath.lineTo(250, 600);
        mPath.close();//设置曲线是否闭合

//        //添加子图形addXXX
//      
上一篇:vscode不同目录导包报错-> "ModuleNotFoundError: No module named 'xxx模块' "


下一篇:Docker这些none:none的镜像,难道就不配拥有名字吗