三阶贝塞尔曲线
drawCoordinateSystem(canvas)
//保存之前Canvas的状态,save之后可以调用Canvas的平移、旋转等操作
canvas.save()
canvas.translate(measuredWidth / 2f, measuredHeight / 2f)
mPaint.color = Color.parseColor("black")
mPaint.style = Paint.Style.STROKE
mPath.rewind()
mPath.moveTo(-500f, 0f)
mPath.cubicTo(-250f, 0f, -250f, 0f, 500f, 0f)
canvas.drawPath(mPath, mPaint)
mPath.rewind()
mPath.moveTo(-500f, 0f)
mPath.cubicTo(-250f, 500f, 250f, -500f, 500f, 0f)
mPaint.color = Color.parseColor("green")
canvas.drawPath(mPath, mPaint)
mPointPaint.color = Color.parseColor("green")
canvas.drawPoints(floatArrayOf(-250f, 500f, 250f, -500f), mPointPaint)
mPath.rewind()
mPath.moveTo(-500f, 0f)
mPath.cubicTo(-250f, -500f, 250f, 500f, 500f, 0f)
mPaint.color = Color.parseColor("purple")
canvas.drawPath(mPath, mPaint)
mPointPaint.color = Color.parseColor("purple")
canvas.drawPoints(floatArrayOf(-250f, -500f, 250f, 500f), mPointPaint)
//与 save() 成对出现,恢复之前保存的canvas状态,防止上述save之后的canvas操作对后续的绘制产生影响
canvas.restore()//