I'm asking about how do apply Xiaolin algorithm to have a smooth corner for image in android I've wrote a algorithm that iterate over the pixels and determine wither this pixel should removed or not to have an corner for image also removing pixel by making it transparent 255 for alpha value but the corner isn't smooth and I'm reading about Xiaolin algorithm for smooth line but because I'm in intermediate java programmer I don't know how to apply this algorithm >>> can any one help me on how to apply this algorithm or suggest another algorithm and how to use it this is my code
int radius = Integer.parseInt(((EditText)MainActivity.this.findViewById(R.id.editTextRadius)).getText().toString());
int xCenter ;
int yCenter;
Bitmap mutableBitmap = BitmapFactory.decodeResource(this.getResources(), R.drawable.h);
Bitmap drawaBitmap = mutableBitmap.copy(Bitmap.Config.ARGB_4444, true);
for (int i = 0; i < radius; i++) {
xCenter = radius;
yCenter = radius;
for (int j = 0; j < radius; j++) {
if (Math.pow(i - xCenter , 2) + Math.pow(j - yCenter , 2) > Math.pow(radius, 2) ) {
drawaBitmap.setPixel(i, j,
Color.argb(255, 255, 255, 255));
}
}
xCenter = radius;
yCenter = drawaBitmap.getHeight()-radius;
for (int j = drawaBitmap.getHeight()-1; j > drawaBitmap.getHeight()-radius; j--) {
if (Math.pow(i - xCenter , 2) + Math.pow(j - yCenter , 2) > Math.pow(radius, 2) ) {
drawaBitmap.setPixel(i, j,
Color.argb(255, 255, 255, 255));
}
}
}
for (int i = drawaBitmap.getWidth()-1; i > drawaBitmap.getWidth()-radius; i--) {
xCenter = drawaBitmap.getWidth() - radius;
yCenter = radius;
for (int j = 0; j < radius; j++) {
if (Math.pow(i - xCenter , 2) + Math.pow(j - yCenter , 2) > Math.pow(radius, 2)) {
drawaBitmap.setPixel(i, j,
Color.argb(255, 255, 255, 255));
}
}
xCenter = drawaBitmap.getWidth()-radius;
yCenter = drawaBitmap.getHeight()-radius;
for (int j = drawaBitmap.getHeight()-1; j > drawaBitmap.getHeight()-radius; j--) {
if (Math.pow(i - xCenter , 2) + Math.pow(j - yCenter , 2) > Math.pow(radius, 2) ) {
drawaBitmap.setPixel(i, j,
Color.argb(255, 255, 255, 255));
}
}
}
((ImageView)this.findViewById(R.id.image)).setImageBitmap(drawaBitmap);
thanks in advance