List of usage examples for android.graphics Bitmap extractAlpha
@CheckResult public Bitmap extractAlpha(Paint paint, int[] offsetXY)
From source file:Main.java
public static Bitmap setShadow(Bitmap bitmap, int radius) { BlurMaskFilter blurFilter = new BlurMaskFilter(radius, BlurMaskFilter.Blur.OUTER); Paint shadowPaint = new Paint(); shadowPaint.setAlpha(50);/*from w w w. j ava 2 s .c o m*/ shadowPaint.setColor(0xff424242); shadowPaint.setMaskFilter(blurFilter); int[] offsetXY = new int[2]; Bitmap shadowBitmap = bitmap.extractAlpha(shadowPaint, offsetXY); Bitmap shadowImage32 = shadowBitmap.copy(Bitmap.Config.ARGB_8888, true); Canvas c = new Canvas(shadowImage32); c.drawBitmap(bitmap, -offsetXY[0], -offsetXY[1], null); return shadowImage32; }