I'm trying to draw a warped rectangle using Canvas
. I've tried using Path
to draw the straight line and then arcTo()
, but I don't know which values should I use. How do I draw a shape similat to the one in the image?
EDIT: This code doesn't work, it draws a straight line.
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);