Skip to content

Instantly share code, notes, and snippets.

@sabadow
Created December 13, 2012 08:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sabadow/4274923 to your computer and use it in GitHub Desktop.
Save sabadow/4274923 to your computer and use it in GitHub Desktop.
Image with rounded corners by Romain Guy
BitmapShader shader;
shader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setShader(shader);
RectF rect = new RectF(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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment