Draw a perfect curve connecting the three points

I would like to draw a curve connecting three points on my screen
PointA = (480.46) PointB = (160.137) PointC = (0.228)

How to draw a curve using the Android API?
Please, help..

Thank,
Sen

+8
android
Sep 28 '10 at 9:46 april
source share
1 answer

Whatever I wanted, I could create it using the following code:

protected void onDraw(Canvas canvas) { super.onDraw(canvas); PointF mPoint1 = new PointF(w/1.2F, h/1.2F); PointF mPoint2 = new PointF(w/24, h/1.2F); Path myPath1 = new Path(); Paint paint = new Paint(); paint.setAntiAlias(true); paint.setStyle(Style.STROKE); paint.setStrokeWidth(2); paint.setColor(Color.WHITE); myPath1 = drawCurve(canvas, paint, mPoint1, mPoint2); canvas.drawPath(myPath1, paint); } private Path drawCurve(Canvas canvas, Paint paint, PointF mPointa, PointF mPointb) { Path myPath = new Path(); myPath.moveTo(63*w/64, h/10); myPath.quadTo(mPointa.x, mPointa.y, mPointb.x, mPointb.y); return myPath; } 

This will find the two sides of the screen (landscape mode) and draw a perfect curve around the screen.

+13
Sep 28 '10 at 13:43 on
source share



All Articles