All Projects → Dimezis → Blurview

Dimezis / Blurview

Licence: apache-2.0
Dynamic iOS-like blur of underlying Views for Android

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Blurview

Xamarin.BlurView
Dynamic iOS-like blur of underlying Views for Android.
Stars: ✭ 26 (-99.04%)
Mutual labels:  blur, blurview
Blurberry
Transparent blur using UIVisualEffectView without subclassing
Stars: ✭ 46 (-98.3%)
Mutual labels:  blur, blurview
Draw
⚽ Champions League draw simulator
Stars: ✭ 134 (-95.04%)
Mutual labels:  draw
Drawingview Android
DrawingView is a simple view that lets you draw on screen using your fingers and lets you save the drawings as images.
Stars: ✭ 206 (-92.37%)
Mutual labels:  draw
Blurdetection2
Blur Detection with OpenCV in Python
Stars: ✭ 156 (-94.22%)
Mutual labels:  blur
Pixelorama
A free & open-source 2D sprite editor, made with the Godot Engine! Available on Windows, Linux, macOS and the Web!
Stars: ✭ 2,535 (-6.15%)
Mutual labels:  draw
Ios Blur
Blur a UIView
Stars: ✭ 2,089 (-22.66%)
Mutual labels:  blur
Bluuur
Native dynamic-radius live blur for iOS
Stars: ✭ 112 (-95.85%)
Mutual labels:  blur
Consolegameengine
.NET Console Graphics Engine
Stars: ✭ 226 (-91.63%)
Mutual labels:  draw
Isketchnfill
Software that can autocomplete sketches as the user starts drawing.
Stars: ✭ 151 (-94.41%)
Mutual labels:  draw
Pencil.js
✏️ Nice modular interactive 2D drawing library
Stars: ✭ 204 (-92.45%)
Mutual labels:  draw
Zlimageeditor
A powerful image editor framework. Supports graffiti, cropping, mosaic, text stickers, image stickers, filters.
Stars: ✭ 148 (-94.52%)
Mutual labels:  draw
Android Jigsaw Puzzle
Android app that allows you to draw anything and turn it into a jigsaw puzzle.
Stars: ✭ 139 (-94.85%)
Mutual labels:  draw
Aseprite
Animated sprite editor & pixel art tool (Windows, macOS, Linux)
Stars: ✭ 14,832 (+449.13%)
Mutual labels:  draw
Urp kawase blur
URP renderfeature test project
Stars: ✭ 138 (-94.89%)
Mutual labels:  blur
Pixieditor
PixiEditor is a lightweight pixel art editor made with .NET 5
Stars: ✭ 210 (-92.23%)
Mutual labels:  draw
Perfect Arrows
Draw perfect arrows between points and shapes.
Stars: ✭ 2,139 (-20.81%)
Mutual labels:  draw
Aachartkit Swift
📈📊📱💻🖥️An elegant modern declarative data visualization chart framework for iOS, iPadOS and macOS. Extremely powerful, supports line, spline, area, areaspline, column, bar, pie, scatter, angular gauges, arearange, areasplinerange, columnrange, bubble, box plot, error bars, funnel, waterfall and polar chart types. 极其精美而又强大的跨平台数据可视化图表框架,支持柱状图、条形图、…
Stars: ✭ 1,962 (-27.36%)
Mutual labels:  draw
Mpv Scripts
Various scripts for mpv
Stars: ✭ 164 (-93.93%)
Mutual labels:  blur
Sketch
Sketch have a lot of basic functions to develop a drawing app for iPhone. Anyone can easily create drawing iOS Application.
Stars: ✭ 229 (-91.52%)
Mutual labels:  draw

BlurView

alt tag

Dynamic iOS-like blur of underlying Views for Android. Includes library and small example project.

BlurView can be used as a regular FrameLayout. It blurs its underlying content and draws it as a background for its children. BlurView redraws its blurred content when changes in view hierarchy are detected (draw() called). It honors its position and size changes, including view animation and property animation.

How to use

  <eightbitlab.com.blurview.BlurView
      android:id="@+id/blurView"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      app:blurOverlayColor="@color/colorOverlay">

       <!--Any child View here, TabLayout for example. This View will NOT be blurred -->

  </eightbitlab.com.blurview.BlurView>
    float radius = 20f;

    View decorView = getWindow().getDecorView();
    //ViewGroup you want to start blur from. Choose root as close to BlurView in hierarchy as possible.
    ViewGroup rootView = (ViewGroup) decorView.findViewById(android.R.id.content);
    //Set drawable to draw in the beginning of each blurred frame (Optional). 
    //Can be used in case your layout has a lot of transparent space and your content
    //gets kinda lost after after blur is applied.
    Drawable windowBackground = decorView.getBackground();

    blurView.setupWith(rootView)
           .setFrameClearDrawable(windowBackground)
           .setBlurAlgorithm(new RenderScriptBlur(this))
           .setBlurRadius(radius)
           .setBlurAutoUpdate(true)
           .setHasFixedTransformationMatrix(true); // Or false if it's in a scrolling container or might be animated

Always try to choose the closest possible root layout to BlurView. This will greatly reduce the amount of work needed for creating View hierarchy snapshot.

You can use setHasFixedTransformationMatrix(true) in case if you are not animating your BlurView, or not putting it in the scrolling container, this might slightly improve the performance as BlurView won't have to recalculate its coordinates on each frame.

DO NOT set View.LAYER_TYPE_HARDWARE or View.LAYER_TYPE_SOFTWARE on the BlurView. It's not supported (even though it could be), because it wouldn't bring any performance benefits.

Supporting API < 17

If you need to support API < 17, you can include

implementation 'com.eightbitlab:supportrenderscriptblur:1.0.2'

setup BlurView with

blurAlgorithm(new SupportRenderScriptBlur(this))

and enable RenderScript support mode

 defaultConfig {
        renderscriptTargetApi 28 //must match target sdk and build tools
        renderscriptSupportModeEnabled true
 }

Important

BlurView can be used only in a hardware-accelerated window. Otherwise, blur will not be drawn. It will fallback to a regular FrameLayout drawing process.

Gradle

implementation 'com.eightbitlab:blurview:1.6.6'

Since JCenter is closing, consider using https://jitpack.io/ and release tags as a source of stable artifacts. Soon the old artifacts won't be available.

Why blurring on the main thread?

Because blurring on some other thread would introduce 1-2 frames latency. Though this is possible and already done on the very old branch as an experiment (which should be rewritten from scratch TBH)

License

Copyright 2021 Dmitry Saviuk

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].