Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Hokoblur | 642 | 6 days ago | 2 | December 24, 2021 | 1 | apache-2.0 | Java | |||
an easy-to-use blur library for Android, support efficient dynamic blur tasks. | ||||||||||
Links And Resources | 208 | 3 years ago | ||||||||
:books: :pencil2: :mortar_board: A collection of textbooks, links and resources during our studying years in NUS SoC | ||||||||||
Msdfgl | 176 | 7 months ago | 7 | mit | C | |||||
OpenGL implementation of the MSDF algorithm | ||||||||||
Volume_rendering_using_glsl | 96 | 10 years ago | 3 | C | ||||||
Cpurasterizer | 92 | 2 years ago | 5 | bsd-2-clause | C++ | |||||
CPU Based Rasterizer Engine | ||||||||||
Rubik Cube | 69 | 6 years ago | 2 | mit | C++ | |||||
Rubik's Cube solver implemented by C++ and OpenGL using Krof/Kociemba algorithm. | ||||||||||
Opencvb | 61 | 19 hours ago | mit | Visual Basic .NET | ||||||
OpenCV .Net application supporting several RGBD cameras - Kinect, Intel RealSense, Luxonis Oak-D, Mynt Eye D 1000, and StereoLabs ZED 2 | ||||||||||
Computer Graphics | 53 | 2 years ago | 1 | mit | C++ | |||||
Beginners Guide to Computer Graphics in C/C++, OpenGL, JavaFX | ||||||||||
Dpixel | 33 | 5 years ago | 19 | gpl-3.0 | C++ | |||||
A Pixel Art Remastering Tool using classic algorithms | ||||||||||
Mach.d | 27 | 3 years ago | 12 | other | D | |||||
Library for the D programming language. |
(中文版本请参看这里)
HokoBlur is an Android component which provides dynamic blur effect.
See the Kotlin implement HokoBlur-Kotlin
Functions:
Features:
implementation 'io.github.hokofly:hoko-blur:1.4.0'
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);
Dynamic Blur provides real-time background blurring of View and ViewGroup, not based on Bitmap implementations. The component will blur the area where the View is located. See the repository HokoBlurDrawable.
When the Bitmap is not scaled (sampleFactor(1.0f)
), the incoming Bitmap will be directly modified by the subsequent operations. So when the function returns a bitmap, it can be used immediately.
It is strongly recommended to use the downScale operation before the blur operation to reduce the size of the blurred image, which will greatly improve the blur efficiency and effect.
Please limit the blur radius to 25. Increasing the radius leads to much less blur effect increase than by increasing the scale factor, and if the radius increase, blur efficiency will also decrease;
The RenderScript solution has to be verified for compatibility. If there are scenarios that require more computation and more complex blurring, the RenderScript scheme may be better.
Algorithm selection
BlurDrawable is implemented by OpenGL, so if the hardware acceleration is not enabled, the background blur will be invalid.
Sample and usage. Please see the sample project.