2

how to draw full circle or point with canvas? I using canvas and path + paint classes

my code:

@Override
public boolean onTouchEvent(MotionEvent event) {
    float eventX = event.getX();
    float eventY = event.getY();
    System.out.println(event.getAction());
    switch (event.getAction()) {
    case MotionEvent.ACTION_DOWN:
        path.moveTo(eventX, eventY);
        return true;
    case MotionEvent.ACTION_MOVE:
        path.lineTo(eventX, eventY);
        break;
    case MotionEvent.ACTION_UP:
        path.addCircle(eventX, eventY, .1F, Path.Direction.CW);
        break;
    default:
        return false;
    }

    // Schedules a repaint.
    invalidate();
    return true;
}
BenG
  • 401
  • 4
  • 7
  • 15

1 Answers1

1

Your paint must be "full", for that you must write this

paint.setStyle(Paint.Style.FILL);

then just draw your circle

canvas.drawCircle(x, y, radius, paint);

I hope it will be helpfull

Arman Manucharyan
  • 237
  • 1
  • 4
  • 18