Reputation: 91
In most of the android applications, the border of the circles are beautiful and the pixels in part of border of the circles are monotonic and beautiful. But when I draw a circle using the following code and when I see the result in my device, the pixels in part of border of the circle is like bitten apple.Such as when an ant has eaten around an apple.
My Code:
class Circle extends View {
Paint paint;
Circle(Context context) {
super(context);
paint = new Paint();
}
@Override
public void onDraw(Canvas canvas) {
paint.setColor(Color.RED);
canvas.drawCircle(50,50,30,paint);
}
}
Upvotes: 2
Views: 60
Reputation: 75778
Please check this demo How to draw a circle in Android set ANTI_ALIAS_FLAG flag true
For more info you may visit:
https://developer.android.com/reference/android/graphics/Canvas.html
Upvotes: 1
Reputation: 1707
Turn on antialiasing to achieve it:
paint.setAntiAlias(true);
Upvotes: 1