
I have a canvas on which I draw this drawing using an array of dots. How to fill it with a specific color?
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
RectF oval = new RectF(90, 100, 200, 300);
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setColor(Color.RED);
paint.setStrokeWidth(5f);
float [] pts = {0,200,
120,140,120,140,
180,20,180,20,
260,100,260,100,
350,20,350,20,
410,140,410,140,
530,200,530,200,
410,260,410,260,
350,380,350,380,
260,300,260,300,
180,380,180,380,
120,260,120,260,
0,200
};
canvas.drawLines(pts, paint);
invalidate();
}
So basically I just want to fill in the color along these points that are present in the array. Any help on this?