eclipse中使用Glide进行高斯模糊处理
来源:互联网 发布:java核心技术 下载 编辑:程序博客网 时间:2024/06/06 02:40
1、下载Glide的jar包,地址:http://pan.baidu.com/s/1ge8ptIV
2、导入eclipse
3、创建类BlurTransformation继承import com.bumptech.glide.load.resource.bitmap.BitmapTransformation;
package com.it.utils;import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;import com.bumptech.glide.load.resource.bitmap.BitmapTransformation;import android.content.Context;import android.graphics.Bitmap;import android.renderscript.Allocation;import android.renderscript.Element;import android.renderscript.RenderScript;import android.renderscript.ScriptIntrinsicBlur;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(20); // 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"; }}4、使用
Glide.with(this).load(picUrl).bitmapTransform(new BlurTransformation(this),
new CenterCrop(this)).into(layCover);
其中picUrl为图片URL,layCover为加载图片的ImageView
0 0
- eclipse中使用Glide进行高斯模糊处理
- Glide框架高斯模糊图片处理
- Glide结合高斯模糊使用
- 使用OpenCV进行图片模糊处理(高斯滤波器)
- glide实现高斯模糊图片
- 高斯模糊处理
- 对图片进行高斯模糊处理的办法
- 使用Glide显示圆图圆角图,高斯模糊图等,超简单
- 使用GCD 多线程进行 图片高斯模糊渲染效果
- Glide-图片预处理(圆角,高斯模糊等)
- 平滑处理----高斯模糊
- 图像处理------高斯模糊
- 高斯模糊化处理
- 头像处理-高斯模糊
- Swift3.0中 图片高斯模糊处理
- android 高斯模糊处理的简单使用
- 对CCSprite进行高斯模糊
- android背景进行高斯模糊
- linux学习笔记006
- 小马哥--高仿苹果7 主板型号A8232 系列刷机拆机主板图与开机识别图
- 用SAXReader文档解析XML文件
- 操作系统之磁盘存储器
- 随笔四、Python基础知识
- eclipse中使用Glide进行高斯模糊处理
- Python学习笔记(1)
- eclipse中创建maven web项目
- Math 对象的方法
- 区间动规经典题——石子合并
- Java项目启动常见错误
- PhpMyAdmin 网站路径信息获取
- 关于session.getValueNames()的一个问题
- Android 界面布局_控件属性篇(长期更新)