项目作者: AsynctaskCoffee

项目描述 :
Android Blurred Images from CustomViews and Bitmaps - Library
高级语言: Kotlin
项目地址: git://github.com/AsynctaskCoffee/BlurryAndroid.git
创建时间: 2020-08-25T22:57:44Z
项目社区:https://github.com/AsynctaskCoffee/BlurryAndroid

开源协议:Apache License 2.0

下载


Blurr :foggy: Easy Blur and Tools Library

Simple and quick solution for blurred bitmaps.

Kotlin Version
License version

Async or Sync, you can quickly blur your images. The library supports Bitmap, Drawable and CustomViews. You have the opportunity to use the necessary libraries separately. If you encounter an error or problem, please open a issue. It will be fixed as soon as possible. :zap:

Features

  • Kotlin
  • Rx3
  • CustomView to Bitmap (usefull for markers - osm and gmap)
  • Blurred Bitmaps
  • Drawable to Bitmap
  • Application Variants

General Usage

  1. /**
  2. * @param bitmapScale should be 0-1f -> small values for more blur
  3. * @param blurRadius should be 0-25f -> bigger values for more blur
  4. *
  5. * @exception RSIllegalArgumentException Radius out of range (0 < r <= 25)
  6. * @exception NullPointerException void android.graphics.Bitmap.setHasAlpha(boolean)
  7. **/
  8. fun applyRules(bitmapScale: Float, blurRadius: Float): Blurr {
  9. bS = bitmapScale
  10. bR = blurRadius
  11. return this
  12. }

Convert Drawable to Blurred Bitmap (async)

  1. Blurr.get(this)
  2. .applyRules(bS, bR)
  3. .into(resources.getDrawable(R.drawable.test_image), imageViewTrial) //async

Convert Drawable to Blurred Bitmap (sync)

  1. val bitmap2 = Blurr
  2. .get(this)
  3. .applyRules(bS, bR)
  4. .solution(resources.getDrawable(R.drawable.test_image))

Convert View Blurred Bitmap (async)

  1. Blurr.get(this)
  2. .applyRules(bS, bR)
  3. .into(view, imageViewTrial) //async

Convert View Blurred Bitmap (sync)

  1. val bitmap1 = Blurr
  2. .get(this)
  3. .applyRules(bS, bR)
  4. .solution(view)

Convert Bitmap to Blurred Bitmap (async)

  1. Blurr.get(this)
  2. .applyRules(bS, bR)
  3. .into(bitmap!!, imageViewTrial) //async

Convert Bitmap to Blurred Bitmap (sync)

  1. val bitmap3 = Blurr
  2. .get(this)
  3. .applyRules(bS, bR)
  4. .solution(bitmap!!)

Tools: Bitmap From Custom Views

  1. val bitmap4 = Blurr
  2. .getTools()
  3. .bitmapFromCustomView(view)

Tools: Bitmap From Drawable

  1. val bitmap5 = Blurr
  2. .getTools()
  3. .bitmapFromDrawable(resources.getDrawable(R.drawable.test_image))

Implementation Gradle

Add it in your root build.gradle at the end of repositories
  1. allprojects {
  2. repositories {
  3. maven { url 'https://jitpack.io' }
  4. }
  5. }
Add the dependency
  1. dependencies {
  2. implementation 'com.github.AsynctaskCoffee:BlurryAndroid:beta-0.1'
  3. }

Implementation Maven

Add the JitPack repository to your build file
  1. <repositories>
  2. <repository>
  3. <id>jitpack.io</id>
  4. <url>https://jitpack.io</url>
  5. </repository>
  6. </repositories>
Add the dependency
  1. <dependency>
  2. <groupId>com.github.AsynctaskCoffee</groupId>
  3. <artifactId>BlurryAndroid</artifactId>
  4. <version>beta-0.1</version>
  5. </dependency>

License

  1. Copyright 2020 Egemen ÖZOGUL
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.