Glide 图片转换
来源:互联网 发布:mp288清零软件错误代码 编辑:程序博客网 时间:2024/05/23 01:18
1,可能是转成圆角图片
public class BlurTransformation extends BitmapTransformation {
private RenderScript rs;
public BlurTransformation(Context context) {
super( context );
rs = RenderScript.create( context );
}
@Override
protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) {
Bitmap blurredBitmap = toTransform.copy( Bitmap.Config.ARGB_8888, true );
// Allocate memory for Renderscript to work with
Allocation input = Allocation.createFromBitmap(
rs,
blurredBitmap,
Allocation.MipmapControl.MIPMAP_FULL,
Allocation.USAGE_SHARED
);
Allocation output = Allocation.createTyped(rs, input.getType());
// Load up an instance of the specific script that we want to use.
ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
script.setInput(input);
// Set the blur radius
script.setRadius(10);
// Start the ScriptIntrinisicBlur
script.forEach(output);
// Copy the output to the blurred bitmap
output.copyTo(blurredBitmap);
toTransform.recycle();
return blurredBitmap;
}
@Override
public String getId() {
return "blur";
}
}
2》加载
Glide
.with( context )
.load( eatFoodyImages[0] )
.transform( new BlurTransformation( context ) )
//.bitmapTransform( new BlurTransformation( context ) ) // 也可以转换
.into( imageView1 );
2,同时多种转换
Glide
.with( context )
.load( eatFoodyImages[1] )
.transform( new GreyscaleTransformation( context ), new BlurTransformation( context ) )
.into( imageView2 );
0 0
- Glide 图片转换
- Glide解析-图片转换过程
- Glide加载图片之自定义转换
- Android Glide加载图片时转换为圆形、圆角、毛玻璃等图片效果
- Android Glide加载图片时转换为圆形、圆角、毛玻璃等图片效果
- Android Glide加载图片时转换为圆形、圆角、毛玻璃等图片效果
- Glide加载图片时转换为圆形、圆角、毛玻璃等图片效果
- 关于安卓glide图片框架加载的图片转换成圆形圆角的思路
- Glide 图像转换
- Glide加载转换Bitmap
- 图片加载库Glide
- Android Glide 图片加载
- Glide加载图片
- 图片加载库Glide
- 图片加载库Glide
- 图片加载框架Glide
- Glide图片加载
- Glide图片缓存框架
- Flink流计算编程--在双流中体会joinedStream与coGroupedStream
- 越南某项目发货
- 时间戳
- AVStream结构体
- Cxf开发webservce实例
- Glide 图片转换
- 盲打
- Swagger使用总结
- Tomcat系列之Java技术详解
- PHP魔术方法的使用
- 在Android中,对图像进行颜色方面的处理图像处理
- mysql 索引创建与使用
- 上拉加载,下拉刷新
- Error[Li006]: duplicate definitions for "******"