user6332149
user6332149

Reputation:

draw curves lines android

I drew 4 lines from the center towards the button as I show you in the photo. I do not know how I can draw curved lines that are in red color in the picture.

[enter image description here]

or

[enter image description here (simpler)]

  Bitmap bitmap = Bitmap.createBitmap((int) getWindowManager()
            .getDefaultDisplay().getWidth(), (int) getWindowManager()
            .getDefaultDisplay().getHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    drawingImageView.setImageBitmap(bitmap);
    DisplayMetrics metrics = this.getResources().getDisplayMetrics();
    int x = metrics.widthPixels;
    int y = metrics.heightPixels;
    Paint paint1 = new Paint () ;
    paint1.setStrokeWidth(10);
    int margin = 100;
    int margin1 = 300;
    int top = 0 + margin;
    int bottom = canvas.getHeight() - margin;
    int left = 0 + margin1;
    int right = canvas.getWidth() - margin1;
    int centerX = x / 2;
    int centerY = y / 2;

    canvas.drawLine(centerX, top, centerX, bottom,paint1);
    canvas.drawLine(left, centerY, right, centerY,paint1);

Upvotes: 0

Views: 1114

Answers (1)

dario.budimir
dario.budimir

Reputation: 161

You will need to split it in 4 different parts (curves) for easier drawing Here is my sketch(sorry for quick drawing)

So you need to get 4 points for bezieres and should be something like this 1st move to start (drawing point)

path.moveTo(x1, y1);

then use next for draw path

cubicTo(x2, y2, x3, y3, x4,y4)

enter image description here

and finally

canvas.drawPath(path, paint);

Same procedure make for rest 3 quadrant/parts hope this will help you to archive your goal

Upvotes: 1

Related Questions