问题描述
我对如何在图像周围创建发光效果进行了很多研究,如下图所示
图片:
我的代码:
ImageView imageView = ((ImageView) findViewById(R.id.bmpImg))
// An added margin to the initial image
int margin = 24;
int halfMargin = margin / 2;
// the glow radius
int glowRadius = 16;
// the glow color
int glowColor = Color.rgb(0,192,255);
// The original image to use
Bitmap src = BitmapFactory.decodeResource(getResources(),R.drawable.myImg);
// extract the alpha from the source image
Bitmap alpha = src.extractAlpha();
// The output bitmap (with the icon + glow)
Bitmap bmp = Bitmap.createBitmap(src.getWidth() + margin,src.getHeight() + margin,Bitmap.Config.ARGB_8888);
// The canvas to paint on the image
Canvas canvas = new Canvas(bmp);
Paint paint = new Paint();
paint.setColor(glowColor);
// outer glow
paint.setMaskFilter(new BlurMaskFilter(glowRadius,Blur.OUTER));
canvas.drawBitmap(alpha,halfMargin,paint);
// original icon
canvas.drawBitmap(src,null);
imageView.setimageBitmap(bmp);
但是我没有任何效果。
任何有创意的人!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)