This is an Android project. Easy and simple library to apply multi shaped blur filter on images.Like circular view, square view, rectangle view and cutView. The library lets you apply a fast blur effect on any images very fast because the image size will be scaled down before apply the blur effect. Doing it asynchronous or not.
Please check the sample app and feel free to ask any thing related to this library.
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
dependencies {
implementation 'com.github.Adnan865:MultiShapeBlurView:1.0.1'
}
defaultConfig {
...
renderscriptTargetApi 19
renderscriptSupportModeEnabled true
}
Step #4. Add actual imageview which you want to blur after hat place shapelayout for blur shape and then place blurred imagevIew in this layout
<ImageView
android:id="@+id/actual_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="0dp"
android:scaleType="centerCrop" />
<com.contentarcade.adnan.shapedblurlibrary.view.ShapeLayout
android:id="@+id/shape_layout_overlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="10dp">
<ImageView
android:id="@+id/blurred_imageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
</com.contentarcade.adnan.shapedblurlibrary.view.ShapeLayout>
<com.contentarcade.adnan.shapedblurlibrary.view.ShapeLayout
android:id="@+id/shape_layout_overlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="10dp">
ShapeLayout shapeLayout = (ShapeLayout) findViewById(R.id.shape_layout_overlay);
shapeLayout.setTypeOfShape(ShapeLayout.ShapeType.RECTANGLE); // by default
// or
shapeLayout.setTypeOfShape(ShapeLayout.ShapeType.CIRCLE);
// or
shapeLayout.setTypeOfShape(ShapeLayout.ShapeType.SQUARE);
// or
shapeLayout.setTypeOfShape(ShapeLayout.ShapeType.CUT);
private void applyBlurView(int r, int size) {
GaussianBlur.with(this)
.size(size)
.radius(r)
.put(R.drawable.home, blurred_imageView);
// .put() also accepts bitmap and drawable
}
int blurRadius = 10;
int blurImageScaledDwonSize = 200;
actualImage.setImageResource(R.drawable.home); //actual image and blured image must be set
applyBlurView(blurRadius, blurImageScaledDwonSize);
<com.contentarcade.adnan.shapedblurlibrary.view.CircleLayout
android:id="@+id/circle_layout_overlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="10dp">
<com.contentarcade.adnan.shapedblurlibrary.view.RectangleLayout
android:id="@+id/rectangle_layout_overlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="10dp">
<com.contentarcade.adnan.shapedblurlibrary.view.SquareLayout
android:id="@+id/square_layout_overlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="10dp">
<com.contentarcade.adnan.shapedblurlibrary.view.CutLayout
android:id="@+id/cut_layout_overlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="10dp">
Click Here For Sample Layout File or Implementation guide