A simple way to draw round image corners

BitmapShader shader;
shader =newBitmapShader(bitmap,Shader.TileMode.CLAMP,Shader.TileMode.CLAMP);
Paint paint =newPaint();
paint.setAntiAlias(true);
paint.setShader(shader);
RectF rect =newRectF(0.0f,0.0f, width, height);
// rect contains the bounds of the shape
// radius is the radius in pixels of the rounded corners
// paint contains the shader that will texture the shape
canvas.drawRoundRect(rect, radius, radius, paint);
From:http://www.curious-creature.org/2012/12/11/android-recipe-1-image-with-rounded-corners/        

你可能感兴趣的:(bitmap,shader)