百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
A

android-stackblur

> 编程语言
开源

Android StackBlur 是一款库,可以根据渐变或半径对 Bitmap 执行模糊效果,并返回结果。该库基于 co

3.6K stars0 点赞0 次浏览
访问官网GitHub

工具介绍

Android StackBlur 是一款库,可以根据渐变或半径对 Bitmap 执行模糊效果,并返回结果。该库基于 co

Android StackBlur

Android StackBlur is a library that can perform a blurry effect on a Bitmap based on a gradient or radius, and return the result. The library is based on the code of Mario Klingemann.

The library is compatible for Android versions 1.5 (so pretty much compatible with every device).

A library and a sample application are provided with the code.

Example Image Example Image

Acknowledgements

  • Mario Klingemann developed the original algorithm and gave me the idea to port it to Android.
  • Manuel Peinado Gallego has generously pointed me out some other sources working on the same area.
  • Nicolas Pomepuy pointed me out to his really useful article on the topic.
  • Dr-Emann for his contribution adding RenderScript and Muiltithreading support.

Usage

Download the library with git. When it has been imported into your project. First initialize your StackBlurManager to load a sample image:

java
    stackBlurManager = new StackBlurManager(getBitmapFromAsset(this, "android_platform_256.png"));

Process using a certain radius with the following line:

java
    stackBlurManager.process(progress*5);

and finally obtain the image and load it into an ImageView or any other component:

java
    imageView.setImageBitmap(_stackBlurManager.returnBlurredImage() );

If you want to use the native code (NDK), first you need to compile the native files. Move to the folder where you have the project, and call:

bash
    ndk-build

If everything goes alright, you will compile and generate a library object, libblur.so, in the folder libs. For more information regarding the NDK framework, please click here. Then, from the code you just need to code:

java
    stackBlurManager.processNatively(progress*5);

The function processNatively(int radius) return the image already blurry. This code is 25-30 times faster as the Java code.

If you want to use RenderScript, you can do it by using:

java
   stackBlurManager.processRenderScript(progress*5);

Version history

  • 10.02.2014: Added Multithreading support thanks to Dr-Emann
  • 27.01.2014: Added Benchmarking, bug fixing thanks to Dr-Emann
  • 10.01.2014: Added RenderScript support thanks to Dr-Emann
  • 04.12.2013: Added support for NDK blurry, much faster.
  • 02.12.2013: Solved the issue #1, provoking an ArrayOutOfBoundsException.
  • 08.09.2013: Added support for Gradle
  • 19.08.2013: Added support for Alpha blurring

Next steps

As soon as I get some free time I want to add the following features:

  • Uploading to MavenCentral
  • Support for PNG9
  • Unit tests

If you want to colaborate with the project, feel free to submit a pull request!

Also, if you have used Android StackBlur on your app and you let me know, I can link it from here :)

Developed By

Enrique López Mañas - [email protected]

Issues· 13 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Java

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言