Path methods
[ answered ]

What is difference between quadTo and cubicTo and arcTo.

این متد ها هر سه برای ترسیم منحنی هستن.

quadTo: برای ترسیم یک منحنی از یک نقطه به یک نقطه دیگه با استفاده از یک نقطه کنترلی

mPath.quadTo(x1, y1, x2, y2) (x1, y1) is the control point and (x2, y2) is the end point.

مثال زیر رو ببینید:

mPath.moveTo(0, 1000); mPath.quadTo(300, 200, 1000, 1000); canvas.drawPath(mPath, mPaint);

quadTo

cubicTo: برای ترسیم یک منحنی از یک نقطه به یک نقطه دیگه با استفاده از دو تا نقطه کنترلی

mPath.cubicTo(x1, y1, x2, y2, x3, y3) (x1, y1) is the control point, (x2, y2) is the control point, and (x3, y3) is the end point.

مثال زیر رو ببینید:

mPath.moveTo(0, 1000); mPath.cubicTo(200, 110, 798, 110, 1000, 1000); canvas.drawPath(mPath, mPaint);

cubicTo

arcTo: این متد هم توی یک Rect میاد و یه منحنی به اندازه درجه ای که بهش میدید ترسیم میکنه واستون

mPath.arcTo(ovalRectF, startAngle, sweepAngle) , ovalRectF is an elliptical rectangle, startAngle is the starting angle, and sweepAngle is the ending angle.

مثال زیر رو ببینید:

mRectF = new RectF(200, 200, 800, 800); mPath.arcTo(mRectF, 0, 165); canvas.drawPath(mPath, mPaint);

arcTo

من یه ویو تستی درست کردم که از صفحه فیلم گرفتم و اینجا میذارم. کاملا تفاوت quad و cubic مشخص هست.

ezgif-5-f7629b0adc86

متد arcTo هم که پیچیدگی خاصی نداره

ezgif-5-b71c4b70d9a5