I am able to draw a rect with sharp edges, now I need to make the sharp edges to rounded.
How to do that?
This is my code:
public void drawShape(Canvas canvas, Renderer renderer, float x, float y,
int seriesIndex, Paint paint) {
float halfShapeWidth = shape_width / 2;
canvas.drawRect(x , y - halfShapeWidth, x + SHAPE_WIDTH, y + halfShapeWidth, paint);
}
How to make this rounded rect by passing the same parameters?
Ok i solved it myself by using this code:
RectF r = new RectF(1,2,3,4);
canvas.drawRoundRect(r, 0, 0, mPaint);
Hope it will help others.
You can use drawRoundRect
You will need to pack the position and the dimensions in a RectF before you can call this function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With