HokoBlur

项目地址:HokoFly/HokoBlur 

简介:an easy-to-use blur library for Android, support efficient dynamic blur jobs.

更多:作者   提 Bug   

标签:

 

(中文版本请参看这里)

HokoBlur is an Android component which provides dynamic blur effect.

1. Introductions

  • Functions:

    • Add blur to the image;
    • Dynamic blur, real-time blurring of the background
  • Features:

    • Multiple schemes: RenderScript、OpenGL、Native and Java;
    • Multiple algorithms: Box、Stack and Gaussian algorithms. Provide different blur effect;
    • Multi-core and multi-threading, accelerate blurring,asynchronous interface;
    • ?iOS-like dynamic backgroud blur: Compared to using RenderScript to process bitmaps, the component has better performance and effect.

2. Getting started

Download

   implementation 'com.hoko:hoko-blur:1.3.3'

Static Blur

synchronous api

HokoBlur.with(context)    .scheme(Blur.SCHEME_NATIVE) //different implementation, RenderScript、OpenGL、Native(default) and Java    .mode(Blur.MODE_STACK) //blur algorithms,Gaussian、Stack(default) and Box    .radius(10) //blur radius,max=25,default=5    .sampleFactor(2.0f) //scale factor,if factor=2,the width and height of a bitmap will be scale to 1/2 sizes,default=5    .forceCopy(false) //If scale factor=1.0f,the origin bitmap will be modified. You could set forceCopy=true to avoid it. default=false    .needUpscale(true) //After blurring,the bitmap will be upscaled to origin sizes,default=true    .translateX(150)//add x axis offset when blurring    .translateY(150)//add y axis offset when blurring    .processor() //build a blur processor    .blur(bitmap);    //blur a bitmap, synchronous method

Daily development does not need such complicated settings. If you want a blur effect, just use as follow:

Bitmap outBitmap = Blur.with(context).blur(bitmap);

When it comes to a large size bitmap, it is recommended to use an asynchronous method. The blur job could be cancelled.

Future f = HokoBlur.with(this)    .scheme(Blur.SCHEME_NATIVE)    .mode(Blur.MODE_STACK)    .radius(10)    .sampleFactor(2.0f)    .forceCopy(false)    .needUpscale(true)    .asyncBlur(bitmap, new AsyncBlurTask.CallBack() {        @Override        public void onBlurSuccess(Bitmap outBitmap) {            // do something...        }        @Override        public void onBlurFailed() {        }    });f.cancel(false);

3. Sample

Animation

更多相关文章

  1. javascript获取Android设备版本信息(备忘)
  2. android自动检测版本更新
  3. 编译Android(安卓)4.0时遇到的问题汇总
  4. Android各个版本对应的源代码
  5. android剪切板
  6. Android(安卓)读取安装的非系统应用程序
  7. android studio release版本下打印输出日志
  8. Android获取apk的版本及包名等信息
  9. android获取版本号

随机推荐

  1. 如何调用另一个函数内的函数?
  2. 如何在onchange()事件后调用的方法中将焦点
  3. 在角JS中Bootstrapping是什么意思?
  4. 动态左侧的GreenSock javascript动画
  5. 使用HTML或Javascript替换网页上的文本
  6. 父范围中的变量不会在匿名函数中被更改[
  7. 如何避免pro拖拉机中的“jasmin .suite()
  8. 如何验证一个大表格
  9. 在迭代完成之前,回调会触发
  10. Knockout.js - 在通过observable设置值