@Override
protected void onDraw(Canvas canvas) {
Log.d("ONDRAW", "onDraw called ");
Drawable drawable = getDrawable();
if (drawable == null) {
return;
}
if (getWidth() == 0 || getHeight() == 0) {
return;
}
Bitmap b = null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP
&& drawable instanceof VectorDrawable) {
((VectorDrawable) drawable).draw(canvas);
b = Bitmap.createBitmap(canvas.getWidth(), canvas.getHeight(), Config.ARGB_8888);
Canvas c = new Canvas();
c.setBitmap(b);
drawable.draw(c);
}
else {
b = ((BitmapDrawable) drawable).getBitmap();
}
Bitmap bitmap = b.copy(Config.ARGB_8888, true);
int w = getWidth(), h = getHeight();
//Bitmap roundBitmap = getCroppedBitmap(bitmap, w);
//Bitmap roundBitmap = blur(bitmap, 50, 220);
//canvas.drawBitmap(roundBitmap, 0,0, null);
super.onDraw(canvas);
Bitmap ors = this.getDrawingCache();
Bitmap or = blur(ors, 20, (int)(0.3 * ors.getHeight()));
canvas.drawBitmap(or, 0,0, null);
}
RoundedImageView.java 文件源码
java
阅读 28
收藏 0
点赞 0
评论 0
项目:Sociadee
作者:
评论列表
文章目录