Code example for BitmapShader

0
	private Paint paint;
 
	public MyRoundCornerDrawable(Bitmap bitmap) {
 
		BitmapShader shader;
		shader = new BitmapShader(bitmap, Shader.TileMode.CLAMP,
				Shader.TileMode.CLAMP);
		paint = new Paint();
		paint.setAntiAlias(true);
		paint.setShader(shader);
	} 
 
	@Override 
	public void draw(Canvas canvas) {
		int height = getBounds().height();
		int width = getBounds().width();
		RectF rect = new RectF(0.0f, 0.0f, width, height);
		canvas.drawRoundRect(rect, 30, 30, paint);
	} 
 
	@Override