mirror of
https://github.com/wasabeef/glide-transformations.git
synced 2025-10-06 11:23:23 +08:00
Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
09e62054e9 | ||
|
4b4f6b1ad4 | ||
|
074b6eef45 | ||
|
fa04c1b3c9 | ||
|
056adc6451 | ||
|
1c925c932e | ||
|
b08325ec70 | ||
|
e9acc52d9e | ||
|
ce14f7bdf1 | ||
|
0b9311813a | ||
|
e16eda6af1 | ||
|
783d69c579 | ||
|
ec0e655f0a | ||
|
9d4d7990d3 | ||
|
d67f715c65 | ||
|
f09f073442 |
7
.editorconfig
Normal file
7
.editorconfig
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
[*]
|
||||||
|
indent_size = 2
|
||||||
|
max_line_length = off
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.{kt, kts}]
|
||||||
|
kotlin_imports_layout = ascii
|
12
.github/FUNDING.yml
vendored
Normal file
12
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
github: wasabeef # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||||
|
patreon: # Replace with a single Patreon username
|
||||||
|
open_collective: # Replace with a single Open Collective username
|
||||||
|
ko_fi: # Replace with a single Ko-fi username
|
||||||
|
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||||
|
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||||
|
liberapay: # Replace with a single Liberapay username
|
||||||
|
issuehunt: # Replace with a single IssueHunt username
|
||||||
|
otechie: # Replace with a single Otechie username
|
||||||
|
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
3
.gitignore
vendored
3
.gitignore
vendored
@@ -48,6 +48,9 @@ captures/
|
|||||||
.idea/modules.xml
|
.idea/modules.xml
|
||||||
.idea/navEditor.xml
|
.idea/navEditor.xml
|
||||||
.idea/markdown*
|
.idea/markdown*
|
||||||
|
.idea/jarRepositories.xml
|
||||||
|
.idea/inspectionProfiles/Project_Default.xml
|
||||||
|
.idea/compiler.xml
|
||||||
projectFilesBackup/
|
projectFilesBackup/
|
||||||
|
|
||||||
# Keystore files
|
# Keystore files
|
||||||
|
116
.idea/codeStyles/Project.xml
generated
Normal file
116
.idea/codeStyles/Project.xml
generated
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<code_scheme name="Project" version="173">
|
||||||
|
<codeStyleSettings language="XML">
|
||||||
|
<indentOptions>
|
||||||
|
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||||
|
</indentOptions>
|
||||||
|
<arrangement>
|
||||||
|
<rules>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>xmlns:android</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>xmlns:.*</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
<order>BY_NAME</order>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*:id</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*:name</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>name</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>style</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
<order>BY_NAME</order>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
<order>ANDROID_ATTRIBUTE_ORDER</order>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>.*</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
<order>BY_NAME</order>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
</rules>
|
||||||
|
</arrangement>
|
||||||
|
</codeStyleSettings>
|
||||||
|
</code_scheme>
|
||||||
|
</component>
|
43
CHANGELOG.md
43
CHANGELOG.md
@@ -1,6 +1,49 @@
|
|||||||
Change Log
|
Change Log
|
||||||
==========
|
==========
|
||||||
|
|
||||||
|
Version 4.3.0 *(2020-09-27)*
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
Feature
|
||||||
|
- Remove support v8 renderscript (Please use BlurTransformation)
|
||||||
|
|
||||||
|
Update
|
||||||
|
- minSdkVersion -> 21
|
||||||
|
- GPUImage -> 2.1.0
|
||||||
|
- Cleanup codes
|
||||||
|
|
||||||
|
Version 4.2.0 *(2020-09-15)*
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
Update:
|
||||||
|
- Compile & Target SDK Version 28 -> 30
|
||||||
|
- GPUImage 2.0.3 -> 2.0.4
|
||||||
|
- Glide 4.9.0 -> 4.11.0
|
||||||
|
|
||||||
|
Bugfix:
|
||||||
|
- RoundedCornersTransformation with DIAGONAL_FROM_TOP_LEFT does not work [#178](https://github.com/wasabeef/glide-transformations/pull/178)
|
||||||
|
|
||||||
|
Version 4.1.0 *(2019-08-15)*
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
Add:
|
||||||
|
- Support to CropCircle with Border [#136](https://github.com/wasabeef/glide-transformations/pull/136)
|
||||||
|
|
||||||
|
Update:
|
||||||
|
- Glide to 4.9.0
|
||||||
|
- Android Gradle plugin to 3.6.0-alpha05
|
||||||
|
- Kotlin to 1.3.41
|
||||||
|
|
||||||
|
Bug Fix:
|
||||||
|
- Fix diffrent density [#147](https://github.com/wasabeef/glide-transformations/pull/147)
|
||||||
|
|
||||||
|
|
||||||
|
Version 4.0.1 *(2018-11-20)*
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
Add:
|
||||||
|
- consumerProguardFiles setting
|
||||||
|
|
||||||
Version 4.0.0 *(2018-11-16)*
|
Version 4.0.0 *(2018-11-16)*
|
||||||
----------------------------
|
----------------------------
|
||||||
|
|
||||||
|
37
README.md
37
README.md
@@ -44,7 +44,7 @@ Set Glide Transform.
|
|||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
Glide.with(this).load(R.drawable.demo)
|
Glide.with(this).load(R.drawable.demo)
|
||||||
.apply(bitmapTransform(BlurTransformation(25, 3)))
|
.apply(RequestOptions.bitmapTransform(BlurTransformation(25, 3)))
|
||||||
.into(imageView)
|
.into(imageView)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ val multi = MultiTransformation<Bitmap>(
|
|||||||
BlurTransformation(25),
|
BlurTransformation(25),
|
||||||
RoundedCornersTransformation(128, 0, CornerType.BOTTOM))))
|
RoundedCornersTransformation(128, 0, CornerType.BOTTOM))))
|
||||||
Glide.with(this).load(R.drawable.demo)
|
Glide.with(this).load(R.drawable.demo)
|
||||||
.apply(bitmapTransform(multi))
|
.apply(RequestOptions.bitmapTransform(multi))
|
||||||
.into(imageView))
|
.into(imageView))
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -79,25 +79,35 @@ android {
|
|||||||
## Transformations
|
## Transformations
|
||||||
|
|
||||||
### Crop
|
### Crop
|
||||||
`CropTransformation`, `CropCircleTransformation`, `CropSquareTransformation`,
|
- `CropTransformation`
|
||||||
`RoundedCornersTransformation`
|
- `CropCircleTransformation`
|
||||||
|
- `CropCircleWithBorderTransformation`
|
||||||
|
- `CropSquareTransformation`
|
||||||
|
- `RoundedCornersTransformation`
|
||||||
|
|
||||||
### Color
|
### Color
|
||||||
`ColorFilterTransformation`, `GrayscaleTransformation`
|
- `ColorFilterTransformation`
|
||||||
|
- `GrayscaleTransformation`
|
||||||
|
|
||||||
### Blur
|
### Blur
|
||||||
`BlurTransformation`
|
- `BlurTransformation`
|
||||||
|
|
||||||
### Mask
|
### Mask
|
||||||
`MaskTransformation`
|
- `MaskTransformation`
|
||||||
|
|
||||||
### GPU Filter (use [GPUImage](https://github.com/CyberAgent/android-gpuimage))
|
### GPU Filter (use [GPUImage](https://github.com/CyberAgent/android-gpuimage))
|
||||||
**Will require add dependencies for GPUImage.**
|
**Will require add dependencies for GPUImage.**
|
||||||
|
|
||||||
`ToonFilterTransformation`, `SepiaFilterTransformation`, `ContrastFilterTransformation`
|
- `ToonFilterTransformation`
|
||||||
`InvertFilterTransformation`, `PixelationFilterTransformation`, `SketchFilterTransformation`
|
- `SepiaFilterTransformation`
|
||||||
`SwirlFilterTransformation`, `BrightnessFilterTransformation`, `KuwaharaFilterTransformation`
|
- `ContrastFilterTransformation`
|
||||||
`VignetteFilterTransformation`
|
- `InvertFilterTransformation`
|
||||||
|
- `PixelationFilterTransformation`
|
||||||
|
- `SketchFilterTransformation`
|
||||||
|
- `SwirlFilterTransformation`
|
||||||
|
- `BrightnessFilterTransformation`
|
||||||
|
- `KuwaharaFilterTransformation`
|
||||||
|
- `VignetteFilterTransformation`
|
||||||
|
|
||||||
|
|
||||||
Applications using Glide Transformations
|
Applications using Glide Transformations
|
||||||
@@ -125,10 +135,11 @@ Contributions
|
|||||||
|
|
||||||
Any contributions are welcome!
|
Any contributions are welcome!
|
||||||
|
|
||||||
Contributers
|
Contributors
|
||||||
-------
|
-------
|
||||||
|
|
||||||
* [start141](https://github.com/start141)
|
* [start141](https://github.com/start141)
|
||||||
|
* [squeeish](https://github.com/squeeish)
|
||||||
|
|
||||||
Thanks
|
Thanks
|
||||||
-------
|
-------
|
||||||
@@ -138,7 +149,7 @@ Thanks
|
|||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
|
|
||||||
Copyright 2018 Wasabeef
|
Copyright (C) 2020 Wasabeef
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
10
build.gradle
10
build.gradle
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext {
|
ext {
|
||||||
kotlin_version = '1.3.0'
|
kotlin_version = '1.3.72'
|
||||||
glide_version = '4.8.0'
|
glide_version = '4.11.0'
|
||||||
gpuimage_version = '2.0.3'
|
gpuimage_version = '2.1.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
@@ -12,8 +12,8 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.4.0-alpha03'
|
classpath 'com.android.tools.build:gradle:4.2.0-alpha12'
|
||||||
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
|
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5'
|
||||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
|
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
}
|
}
|
||||||
|
@@ -8,61 +8,34 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion MIN_SDK_VERSION as int
|
minSdkVersion MIN_SDK_VERSION as int
|
||||||
targetSdkVersion TARGET_SDK_VERSION as int
|
targetSdkVersion TARGET_SDK_VERSION as int
|
||||||
versionCode "git rev-list origin/master --count".execute().text.toInteger()
|
versionCode VERSION_CODE as int
|
||||||
versionName VERSION_NAME
|
versionName VERSION_NAME
|
||||||
|
|
||||||
renderscriptTargetApi TARGET_SDK_VERSION as int
|
|
||||||
renderscriptSupportModeEnabled true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
signingConfigs {
|
// SigningConfigs
|
||||||
release {
|
apply from: '../signingConfigs/debug.gradle', to: android
|
||||||
storeFile file(keyStoreProperty)
|
|
||||||
keyAlias keyAliasProperty
|
|
||||||
storePassword keyStorePasswordProperty
|
|
||||||
keyPassword keyAliasPasswordProperty
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
debug {
|
debug {
|
||||||
debuggable true
|
debuggable true
|
||||||
zipAlignEnabled true
|
signingConfig signingConfigs.debug
|
||||||
}
|
}
|
||||||
release {
|
release {
|
||||||
debuggable false
|
debuggable false
|
||||||
zipAlignEnabled true
|
zipAlignEnabled true
|
||||||
minifyEnabled true
|
minifyEnabled true
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
||||||
shrinkResources true
|
shrinkResources true
|
||||||
signingConfig signingConfigs.release
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def getKeyStoreProperty() {
|
|
||||||
return hasProperty('WASABEEF_KEYSTORE') ? WASABEEF_KEYSTORE : "debug.keystore"
|
|
||||||
}
|
|
||||||
|
|
||||||
def getKeyAliasProperty() {
|
|
||||||
return hasProperty('WASABEEF_KEYALIAS') ? WASABEEF_KEYALIAS : "android"
|
|
||||||
}
|
|
||||||
|
|
||||||
def getKeyStorePasswordProperty() {
|
|
||||||
return hasProperty('WASABEEF_KEYSTOREPASSWORD') ? WASABEEF_KEYSTOREPASSWORD : "androiddebugkey"
|
|
||||||
}
|
|
||||||
|
|
||||||
def getKeyAliasPasswordProperty() {
|
|
||||||
return hasProperty('WASABEEF_KEYALIASPASSWORD') ? WASABEEF_KEYALIASPASSWORD : "android"
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':transformations')
|
implementation project(':transformations')
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||||
implementation "com.github.bumptech.glide:glide:$glide_version"
|
implementation "com.github.bumptech.glide:glide:$glide_version"
|
||||||
kapt "com.github.bumptech.glide:compiler:$glide_version"
|
kapt "com.github.bumptech.glide:compiler:$glide_version"
|
||||||
implementation "jp.co.cyberagent.android:gpuimage:$gpuimage_version"
|
implementation "jp.co.cyberagent.android:gpuimage:$gpuimage_version"
|
||||||
implementation "androidx.appcompat:appcompat:1.0.2"
|
implementation "androidx.appcompat:appcompat:1.3.0-alpha02"
|
||||||
implementation "androidx.recyclerview:recyclerview:1.0.0"
|
implementation "androidx.recyclerview:recyclerview:1.2.0-alpha05"
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
package="jp.wasabeef.example.glide"
|
package="jp.wasabeef.example.glide">
|
||||||
>
|
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
@@ -12,8 +11,7 @@
|
|||||||
tools:ignore="GoogleAppIndexingWarning">
|
tools:ignore="GoogleAppIndexingWarning">
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name">
|
||||||
>
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package jp.wasabeef.example.glide
|
package jp.wasabeef.example.glide
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2018 Wasabeef
|
* Copyright (C) 2020 Wasabeef
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@@ -15,9 +15,9 @@ class MainActivity : AppCompatActivity() {
|
|||||||
findViewById<RecyclerView>(R.id.list).apply {
|
findViewById<RecyclerView>(R.id.list).apply {
|
||||||
layoutManager = LinearLayoutManager(context)
|
layoutManager = LinearLayoutManager(context)
|
||||||
adapter = MainAdapter(context, mutableListOf(
|
adapter = MainAdapter(context, mutableListOf(
|
||||||
Mask, NinePatchMask, CropTop, CropCenter, CropBottom, CropSquare, CropCircle, Grayscale,
|
Mask, NinePatchMask, RoundedCorners, CropTop, CropCenter, CropBottom, CropSquare, CropCircle,
|
||||||
Blur, SupportRSBlur, Toon, Sepia, Contrast, Invert, Pixel, Sketch, Swirl, Brightness,
|
CropCircleWithBorder, Grayscale, BlurLight, BlurDeep, Toon, Sepia, Contrast, Invert,
|
||||||
Kuawahara, Vignette
|
Pixel, Sketch, Swirl, Brightness, Kuawahara, Vignette
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -19,6 +19,7 @@ import jp.wasabeef.example.glide.MainAdapter.Type.*
|
|||||||
import jp.wasabeef.glide.transformations.*
|
import jp.wasabeef.glide.transformations.*
|
||||||
import jp.wasabeef.glide.transformations.CropTransformation.CropType
|
import jp.wasabeef.glide.transformations.CropTransformation.CropType
|
||||||
import jp.wasabeef.glide.transformations.gpu.*
|
import jp.wasabeef.glide.transformations.gpu.*
|
||||||
|
import jp.wasabeef.glide.transformations.internal.Utils
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Wasabeef on 2015/01/11.
|
* Created by Wasabeef on 2015/01/11.
|
||||||
@@ -36,11 +37,12 @@ class MainAdapter(
|
|||||||
CropBottom,
|
CropBottom,
|
||||||
CropSquare,
|
CropSquare,
|
||||||
CropCircle,
|
CropCircle,
|
||||||
|
CropCircleWithBorder,
|
||||||
ColorFilter,
|
ColorFilter,
|
||||||
Grayscale,
|
Grayscale,
|
||||||
RoundedCorners,
|
RoundedCorners,
|
||||||
Blur,
|
BlurLight,
|
||||||
SupportRSBlur,
|
BlurDeep,
|
||||||
Toon,
|
Toon,
|
||||||
Sepia,
|
Sepia,
|
||||||
Contrast,
|
Contrast,
|
||||||
@@ -65,7 +67,7 @@ class MainAdapter(
|
|||||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
|
|
||||||
when (dataSet[position]) {
|
when (dataSet[position]) {
|
||||||
MainAdapter.Type.Mask -> {
|
Mask -> {
|
||||||
Glide.with(context)
|
Glide.with(context)
|
||||||
.load(R.drawable.check)
|
.load(R.drawable.check)
|
||||||
.apply(overrideOf(266.px, 252.px))
|
.apply(overrideOf(266.px, 252.px))
|
||||||
@@ -73,7 +75,7 @@ class MainAdapter(
|
|||||||
MaskTransformation(R.drawable.mask_starfish))))
|
MaskTransformation(R.drawable.mask_starfish))))
|
||||||
.into(holder.image)
|
.into(holder.image)
|
||||||
}
|
}
|
||||||
MainAdapter.Type.NinePatchMask -> {
|
NinePatchMask -> {
|
||||||
Glide.with(context)
|
Glide.with(context)
|
||||||
.load(R.drawable.check)
|
.load(R.drawable.check)
|
||||||
.apply(overrideOf(300.px, 200.px))
|
.apply(overrideOf(300.px, 200.px))
|
||||||
@@ -107,6 +109,12 @@ class MainAdapter(
|
|||||||
.apply(bitmapTransform(CropCircleTransformation()))
|
.apply(bitmapTransform(CropCircleTransformation()))
|
||||||
.into(holder.image)
|
.into(holder.image)
|
||||||
|
|
||||||
|
CropCircleWithBorder -> Glide.with(context)
|
||||||
|
.load(R.drawable.demo)
|
||||||
|
.apply(bitmapTransform(
|
||||||
|
CropCircleWithBorderTransformation(Utils.toDp(4), Color.rgb(0, 145, 86))))
|
||||||
|
.into(holder.image)
|
||||||
|
|
||||||
ColorFilter -> Glide.with(context)
|
ColorFilter -> Glide.with(context)
|
||||||
.load(R.drawable.demo)
|
.load(R.drawable.demo)
|
||||||
.apply(bitmapTransform(ColorFilterTransformation(Color.argb(80, 255, 0, 0))))
|
.apply(bitmapTransform(ColorFilterTransformation(Color.argb(80, 255, 0, 0))))
|
||||||
@@ -119,18 +127,18 @@ class MainAdapter(
|
|||||||
|
|
||||||
RoundedCorners -> Glide.with(context)
|
RoundedCorners -> Glide.with(context)
|
||||||
.load(R.drawable.demo)
|
.load(R.drawable.demo)
|
||||||
.apply(bitmapTransform(RoundedCornersTransformation(45, 0,
|
.apply(bitmapTransform(RoundedCornersTransformation(120, 0,
|
||||||
RoundedCornersTransformation.CornerType.BOTTOM)))
|
RoundedCornersTransformation.CornerType.DIAGONAL_FROM_TOP_LEFT)))
|
||||||
.into(holder.image)
|
.into(holder.image)
|
||||||
|
|
||||||
Blur -> Glide.with(context)
|
BlurLight -> Glide.with(context)
|
||||||
.load(R.drawable.check)
|
.load(R.drawable.check)
|
||||||
.apply(bitmapTransform(BlurTransformation(25)))
|
.apply(bitmapTransform(BlurTransformation(25)))
|
||||||
.into(holder.image)
|
.into(holder.image)
|
||||||
|
|
||||||
SupportRSBlur -> Glide.with(context)
|
BlurDeep -> Glide.with(context)
|
||||||
.load(R.drawable.check)
|
.load(R.drawable.check)
|
||||||
.apply(bitmapTransform(SupportRSBlurTransformation(25, 10)))
|
.apply(bitmapTransform(BlurTransformation(25, 8)))
|
||||||
.into(holder.image)
|
.into(holder.image)
|
||||||
|
|
||||||
Toon -> Glide.with(context)
|
Toon -> Glide.with(context)
|
||||||
|
@@ -1,10 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
>
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/list"
|
android:id="@+id/list"
|
||||||
@@ -13,6 +11,5 @@
|
|||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
/>
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
@@ -1,10 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
>
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/image"
|
android:id="@+id/image"
|
||||||
@@ -19,8 +17,8 @@
|
|||||||
app:layout_constraintBottom_toTopOf="@+id/title"
|
app:layout_constraintBottom_toTopOf="@+id/title"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
/>
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/title"
|
android:id="@+id/title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@@ -30,6 +28,5 @@
|
|||||||
android:layout_marginStart="8dp"
|
android:layout_marginStart="8dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
/>
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
@@ -1,35 +1,16 @@
|
|||||||
# Project-wide Gradle settings.
|
|
||||||
# IDE (e.g. Android Studio) users:
|
|
||||||
# Gradle settings configured through the IDE *will override*
|
|
||||||
# any settings specified in this file.
|
|
||||||
# For more details on how to configure your build environment visit
|
|
||||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
|
||||||
# Specifies the JVM arguments used for the daemon process.
|
|
||||||
# The setting is particularly useful for tweaking memory settings.
|
|
||||||
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||||
# When configured, Gradle will run in incubating parallel mode.
|
|
||||||
# This option should only be used with decoupled projects. More details, visit
|
|
||||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
org.gradle.daemon=true
|
org.gradle.daemon=true
|
||||||
org.gradle.configureondemand=true
|
org.gradle.configureondemand=true
|
||||||
org.gradle.caching=true
|
org.gradle.caching=true
|
||||||
android.enableBuildCache=true
|
android.enableBuildCache=true
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
android.enableJetifier=true
|
|
||||||
|
|
||||||
# Use R8 instead of ProGuard for code shrinking.
|
# Use R8 instead of ProGuard for code shrinking.
|
||||||
android.enableR8=true
|
|
||||||
android.enableR8.fullMode=true
|
android.enableR8.fullMode=true
|
||||||
|
|
||||||
# Enable rudimentary R class namespacing where each library only contains
|
VERSION_NAME=4.3.0
|
||||||
# references to the resources it declares instead of declarations plus all
|
VERSION_CODE=421
|
||||||
# transitive dependency references.
|
|
||||||
android.namespacedRClass=true
|
|
||||||
|
|
||||||
VERSION_NAME=4.0.0
|
|
||||||
GROUP=jp.wasabeef
|
GROUP=jp.wasabeef
|
||||||
|
COMPILE_SDK_VERSION=30
|
||||||
COMPILE_SDK_VERSION=28
|
TARGET_SDK_VERSION=30
|
||||||
TARGET_SDK_VERSION=28
|
MIN_SDK_VERSION=21
|
||||||
MIN_SDK_VERSION=14
|
|
||||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-milestone-1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
53
gradlew
vendored
53
gradlew
vendored
@@ -1,5 +1,21 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2015 the original author or authors.
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# https://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.
|
||||||
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
##
|
||||||
## Gradle start up script for UN*X
|
## Gradle start up script for UN*X
|
||||||
@@ -28,7 +44,7 @@ APP_NAME="Gradle"
|
|||||||
APP_BASE_NAME=`basename "$0"`
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
DEFAULT_JVM_OPTS=""
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD="maximum"
|
MAX_FD="maximum"
|
||||||
@@ -66,6 +82,7 @@ esac
|
|||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
@@ -109,10 +126,11 @@ if $darwin; then
|
|||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For Cygwin, switch paths to Windows format before running java
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
if $cygwin ; then
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
@@ -138,19 +156,19 @@ if $cygwin ; then
|
|||||||
else
|
else
|
||||||
eval `echo args$i`="\"$arg\""
|
eval `echo args$i`="\"$arg\""
|
||||||
fi
|
fi
|
||||||
i=$((i+1))
|
i=`expr $i + 1`
|
||||||
done
|
done
|
||||||
case $i in
|
case $i in
|
||||||
(0) set -- ;;
|
0) set -- ;;
|
||||||
(1) set -- "$args0" ;;
|
1) set -- "$args0" ;;
|
||||||
(2) set -- "$args0" "$args1" ;;
|
2) set -- "$args0" "$args1" ;;
|
||||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -159,14 +177,9 @@ save () {
|
|||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
echo " "
|
echo " "
|
||||||
}
|
}
|
||||||
APP_ARGS=$(save "$@")
|
APP_ARGS=`save "$@"`
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
|
||||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
|
||||||
cd "$(dirname "$0")"
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
43
gradlew.bat
vendored
43
gradlew.bat
vendored
@@ -1,3 +1,19 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%" == "" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@@ -13,15 +29,18 @@ if "%DIRNAME%" == "" set DIRNAME=.
|
|||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
set DEFAULT_JVM_OPTS=
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
@rem Find java.exe
|
@rem Find java.exe
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto init
|
if "%ERRORLEVEL%" == "0" goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
@@ -35,7 +54,7 @@ goto fail
|
|||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto init
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
@@ -45,28 +64,14 @@ echo location of your Java installation.
|
|||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
:init
|
|
||||||
@rem Get command-line arguments, handling Windows variants
|
|
||||||
|
|
||||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
|
||||||
|
|
||||||
:win9xME_args
|
|
||||||
@rem Slurp the command line arguments.
|
|
||||||
set CMD_LINE_ARGS=
|
|
||||||
set _SKIP=2
|
|
||||||
|
|
||||||
:win9xME_args_slurp
|
|
||||||
if "x%~1" == "x" goto execute
|
|
||||||
|
|
||||||
set CMD_LINE_ARGS=%*
|
|
||||||
|
|
||||||
:execute
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
@rem Execute Gradle
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
14
signingConfigs/debug.gradle
Normal file
14
signingConfigs/debug.gradle
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
signingConfigs {
|
||||||
|
debug {
|
||||||
|
storeFile file("debug.keystore")
|
||||||
|
storePassword "android"
|
||||||
|
keyAlias "androiddebugkey"
|
||||||
|
keyPassword "android"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// $ keytool -v -list -keystore
|
||||||
|
// Certificate fingerprints:
|
||||||
|
// MD5: 28:22:7C:A4:B9:2F:6E:C7:D5:58:62:48:EB:7E:82:C3
|
||||||
|
// SHA1: 94:25:A9:50:9C:0E:AE:AA:00:37:5E:D6:71:E3:BC:ED:17:E5:0C:A3
|
||||||
|
// SHA256: 04:92:39:09:3D:1C:B6:16:BE:55:58:A3:5F:3B:BB:CB:0B:E7:F1:DA:AA:26:C5:2D:BD:2F:44:CF:AE:47:CF:87
|
BIN
signingConfigs/debug.keystore
Normal file
BIN
signingConfigs/debug.keystore
Normal file
Binary file not shown.
@@ -7,8 +7,7 @@ android {
|
|||||||
minSdkVersion MIN_SDK_VERSION as int
|
minSdkVersion MIN_SDK_VERSION as int
|
||||||
targetSdkVersion TARGET_SDK_VERSION as int
|
targetSdkVersion TARGET_SDK_VERSION as int
|
||||||
|
|
||||||
renderscriptTargetApi TARGET_SDK_VERSION as int
|
consumerProguardFiles 'proguard-rules.txt'
|
||||||
renderscriptSupportModeEnabled true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,7 +24,7 @@ ext {
|
|||||||
publishedGroupId = 'jp.wasabeef'
|
publishedGroupId = 'jp.wasabeef'
|
||||||
libraryName = 'glide-transformations'
|
libraryName = 'glide-transformations'
|
||||||
artifact = 'glide-transformations'
|
artifact = 'glide-transformations'
|
||||||
libraryDescription = 'Which provides simple Tranformations to Glide'
|
libraryDescription = 'Which provides simple Transformations to Glide'
|
||||||
siteUrl = 'https://github.com/wasabeef/glide-transformations'
|
siteUrl = 'https://github.com/wasabeef/glide-transformations'
|
||||||
gitUrl = 'https://github.com/wasabeef/glide-transformations.git'
|
gitUrl = 'https://github.com/wasabeef/glide-transformations.git'
|
||||||
issueUrl = 'https://github.com/wasabeef/glide-transformations/issues'
|
issueUrl = 'https://github.com/wasabeef/glide-transformations/issues'
|
||||||
|
@@ -1 +1 @@
|
|||||||
<manifest package="jp.wasabeef.glide.transformations"></manifest>
|
<manifest package="jp.wasabeef.glide.transformations" />
|
||||||
|
@@ -1,15 +1,15 @@
|
|||||||
package jp.wasabeef.glide.transformations;
|
package jp.wasabeef.glide.transformations;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2018 Wasabeef
|
* Copyright (C) 2020 Wasabeef
|
||||||
* Copyright 2014 Google, Inc. All rights reserved.
|
* Copyright 2014 Google, Inc. All rights reserved.
|
||||||
*
|
* <p>
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
* <p>
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
* <p>
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@@ -20,6 +20,8 @@ package jp.wasabeef.glide.transformations;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
import com.bumptech.glide.load.Transformation;
|
import com.bumptech.glide.load.Transformation;
|
||||||
import com.bumptech.glide.load.engine.Resource;
|
import com.bumptech.glide.load.engine.Resource;
|
||||||
@@ -30,8 +32,6 @@ import com.bumptech.glide.util.Util;
|
|||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
public abstract class BitmapTransformation implements Transformation<Bitmap> {
|
public abstract class BitmapTransformation implements Transformation<Bitmap> {
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@@ -58,6 +58,10 @@ public abstract class BitmapTransformation implements Transformation<Bitmap> {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setCanvasBitmapDensity(@NonNull Bitmap toTransform, @NonNull Bitmap canvasBitmap) {
|
||||||
|
canvasBitmap.setDensity(toTransform.getDensity());
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract Bitmap transform(@NonNull Context context, @NonNull BitmapPool pool,
|
protected abstract Bitmap transform(@NonNull Context context, @NonNull BitmapPool pool,
|
||||||
@NonNull Bitmap toTransform, int outWidth, int outHeight);
|
@NonNull Bitmap toTransform, int outWidth, int outHeight);
|
||||||
|
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
package jp.wasabeef.glide.transformations;
|
package jp.wasabeef.glide.transformations;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2018 Wasabeef
|
* Copyright (C) 2020 Wasabeef
|
||||||
*
|
* <p>
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
* <p>
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
* <p>
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@@ -20,13 +20,16 @@ import android.content.Context;
|
|||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
|
import android.renderscript.RSRuntimeException;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import jp.wasabeef.glide.transformations.internal.FastBlur;
|
import jp.wasabeef.glide.transformations.internal.FastBlur;
|
||||||
|
import jp.wasabeef.glide.transformations.internal.RSBlur;
|
||||||
|
|
||||||
public class BlurTransformation extends BitmapTransformation {
|
public class BlurTransformation extends BitmapTransformation {
|
||||||
|
|
||||||
@@ -34,11 +37,11 @@ public class BlurTransformation extends BitmapTransformation {
|
|||||||
private static final String ID =
|
private static final String ID =
|
||||||
"jp.wasabeef.glide.transformations.BlurTransformation." + VERSION;
|
"jp.wasabeef.glide.transformations.BlurTransformation." + VERSION;
|
||||||
|
|
||||||
private static int MAX_RADIUS = 25;
|
private static final int MAX_RADIUS = 25;
|
||||||
private static int DEFAULT_DOWN_SAMPLING = 1;
|
private static final int DEFAULT_DOWN_SAMPLING = 1;
|
||||||
|
|
||||||
private int radius;
|
private final int radius;
|
||||||
private int sampling;
|
private final int sampling;
|
||||||
|
|
||||||
public BlurTransformation() {
|
public BlurTransformation() {
|
||||||
this(MAX_RADIUS, DEFAULT_DOWN_SAMPLING);
|
this(MAX_RADIUS, DEFAULT_DOWN_SAMPLING);
|
||||||
@@ -64,13 +67,19 @@ public class BlurTransformation extends BitmapTransformation {
|
|||||||
|
|
||||||
Bitmap bitmap = pool.get(scaledWidth, scaledHeight, Bitmap.Config.ARGB_8888);
|
Bitmap bitmap = pool.get(scaledWidth, scaledHeight, Bitmap.Config.ARGB_8888);
|
||||||
|
|
||||||
|
setCanvasBitmapDensity(toTransform, bitmap);
|
||||||
|
|
||||||
Canvas canvas = new Canvas(bitmap);
|
Canvas canvas = new Canvas(bitmap);
|
||||||
canvas.scale(1 / (float) sampling, 1 / (float) sampling);
|
canvas.scale(1 / (float) sampling, 1 / (float) sampling);
|
||||||
Paint paint = new Paint();
|
Paint paint = new Paint();
|
||||||
paint.setFlags(Paint.FILTER_BITMAP_FLAG);
|
paint.setFlags(Paint.FILTER_BITMAP_FLAG);
|
||||||
canvas.drawBitmap(toTransform, 0, 0, paint);
|
canvas.drawBitmap(toTransform, 0, 0, paint);
|
||||||
|
|
||||||
|
try {
|
||||||
|
bitmap = RSBlur.blur(context, bitmap, radius);
|
||||||
|
} catch (RSRuntimeException e) {
|
||||||
bitmap = FastBlur.blur(bitmap, radius, true);
|
bitmap = FastBlur.blur(bitmap, radius, true);
|
||||||
|
}
|
||||||
|
|
||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
package jp.wasabeef.glide.transformations;
|
package jp.wasabeef.glide.transformations;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2018 Wasabeef
|
* Copyright (C) 2020 Wasabeef
|
||||||
*
|
* <p>
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
* <p>
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
* <p>
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@@ -23,19 +23,19 @@ import android.graphics.Paint;
|
|||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
import android.graphics.PorterDuffColorFilter;
|
import android.graphics.PorterDuffColorFilter;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
public class ColorFilterTransformation extends BitmapTransformation {
|
public class ColorFilterTransformation extends BitmapTransformation {
|
||||||
|
|
||||||
private static final int VERSION = 1;
|
private static final int VERSION = 1;
|
||||||
private static final String ID =
|
private static final String ID =
|
||||||
"jp.wasabeef.glide.transformations.ColorFilterTransformation." + VERSION;
|
"jp.wasabeef.glide.transformations.ColorFilterTransformation." + VERSION;
|
||||||
|
|
||||||
private int color;
|
private final int color;
|
||||||
|
|
||||||
public ColorFilterTransformation(int color) {
|
public ColorFilterTransformation(int color) {
|
||||||
this.color = color;
|
this.color = color;
|
||||||
@@ -51,6 +51,8 @@ public class ColorFilterTransformation extends BitmapTransformation {
|
|||||||
toTransform.getConfig() != null ? toTransform.getConfig() : Bitmap.Config.ARGB_8888;
|
toTransform.getConfig() != null ? toTransform.getConfig() : Bitmap.Config.ARGB_8888;
|
||||||
Bitmap bitmap = pool.get(width, height, config);
|
Bitmap bitmap = pool.get(width, height, config);
|
||||||
|
|
||||||
|
setCanvasBitmapDensity(toTransform, bitmap);
|
||||||
|
|
||||||
Canvas canvas = new Canvas(bitmap);
|
Canvas canvas = new Canvas(bitmap);
|
||||||
Paint paint = new Paint();
|
Paint paint = new Paint();
|
||||||
paint.setAntiAlias(true);
|
paint.setAntiAlias(true);
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
package jp.wasabeef.glide.transformations;
|
package jp.wasabeef.glide.transformations;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2018 Wasabeef
|
* Copyright (C) 2020 Wasabeef
|
||||||
*
|
* <p>
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
* <p>
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
* <p>
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@@ -19,14 +19,14 @@ package jp.wasabeef.glide.transformations;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
||||||
import com.bumptech.glide.load.resource.bitmap.TransformationUtils;
|
import com.bumptech.glide.load.resource.bitmap.TransformationUtils;
|
||||||
import com.bumptech.glide.request.RequestOptions;
|
import com.bumptech.glide.request.RequestOptions;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Use {@link RequestOptions#circleCrop()}.
|
* @deprecated Use {@link RequestOptions#circleCrop()}.
|
||||||
*/
|
*/
|
||||||
|
@@ -0,0 +1,96 @@
|
|||||||
|
package jp.wasabeef.glide.transformations;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.Paint;
|
||||||
|
|
||||||
|
import androidx.annotation.ColorInt;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
||||||
|
import com.bumptech.glide.load.resource.bitmap.TransformationUtils;
|
||||||
|
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
|
||||||
|
import jp.wasabeef.glide.transformations.internal.Utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (C) 2020 Wasabeef
|
||||||
|
* <p>
|
||||||
|
* 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
|
||||||
|
* <p>
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* <p>
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class CropCircleWithBorderTransformation extends BitmapTransformation {
|
||||||
|
|
||||||
|
|
||||||
|
private static final int VERSION = 1;
|
||||||
|
private static final String ID = "jp.wasabeef.glide.transformations.CropCircleWithBorderTransformation." + VERSION;
|
||||||
|
|
||||||
|
private final int borderSize;
|
||||||
|
private final int borderColor;
|
||||||
|
|
||||||
|
|
||||||
|
public CropCircleWithBorderTransformation() {
|
||||||
|
this.borderSize = Utils.toDp(4);
|
||||||
|
this.borderColor = Color.BLACK;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CropCircleWithBorderTransformation(int borderSize, @ColorInt int borderColor) {
|
||||||
|
this.borderSize = borderSize;
|
||||||
|
this.borderColor = borderColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Bitmap transform(@NonNull Context context, @NonNull BitmapPool pool,
|
||||||
|
@NonNull Bitmap toTransform, int outWidth, int outHeight) {
|
||||||
|
|
||||||
|
Bitmap bitmap = TransformationUtils.circleCrop(pool, toTransform, outWidth, outHeight);
|
||||||
|
|
||||||
|
setCanvasBitmapDensity(toTransform, bitmap);
|
||||||
|
|
||||||
|
Paint paint = new Paint();
|
||||||
|
paint.setColor(borderColor);
|
||||||
|
paint.setStyle(Paint.Style.STROKE);
|
||||||
|
paint.setStrokeWidth(borderSize);
|
||||||
|
paint.setAntiAlias(true);
|
||||||
|
|
||||||
|
Canvas canvas = new Canvas(bitmap);
|
||||||
|
canvas.drawCircle(
|
||||||
|
outWidth / 2f,
|
||||||
|
outHeight / 2f,
|
||||||
|
Math.max(outWidth, outHeight) / 2f - borderSize / 2f,
|
||||||
|
paint
|
||||||
|
);
|
||||||
|
|
||||||
|
return bitmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
||||||
|
messageDigest.update((ID + borderSize + borderColor).getBytes(CHARSET));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
return o instanceof CropCircleWithBorderTransformation &&
|
||||||
|
((CropCircleWithBorderTransformation) o).borderSize == borderSize &&
|
||||||
|
((CropCircleWithBorderTransformation) o).borderColor == borderColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return ID.hashCode() + borderSize * 100 + borderColor + 10;
|
||||||
|
}
|
||||||
|
}
|
@@ -1,14 +1,14 @@
|
|||||||
package jp.wasabeef.glide.transformations;
|
package jp.wasabeef.glide.transformations;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2018 Wasabeef
|
* Copyright (C) 2020 Wasabeef
|
||||||
*
|
* <p>
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
* <p>
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
* <p>
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@@ -19,13 +19,13 @@ package jp.wasabeef.glide.transformations;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
||||||
import com.bumptech.glide.load.resource.bitmap.TransformationUtils;
|
import com.bumptech.glide.load.resource.bitmap.TransformationUtils;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
public class CropSquareTransformation extends BitmapTransformation {
|
public class CropSquareTransformation extends BitmapTransformation {
|
||||||
|
|
||||||
private static final int VERSION = 1;
|
private static final int VERSION = 1;
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
package jp.wasabeef.glide.transformations;
|
package jp.wasabeef.glide.transformations;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2018 Wasabeef
|
* Copyright (C) 2020 Wasabeef
|
||||||
*
|
* <p>
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
* <p>
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
* <p>
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@@ -21,12 +21,12 @@ import android.graphics.Bitmap;
|
|||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
public class CropTransformation extends BitmapTransformation {
|
public class CropTransformation extends BitmapTransformation {
|
||||||
|
|
||||||
private static final int VERSION = 1;
|
private static final int VERSION = 1;
|
||||||
@@ -76,6 +76,8 @@ public class CropTransformation extends BitmapTransformation {
|
|||||||
float top = getTop(scaledHeight);
|
float top = getTop(scaledHeight);
|
||||||
RectF targetRect = new RectF(left, top, left + scaledWidth, top + scaledHeight);
|
RectF targetRect = new RectF(left, top, left + scaledWidth, top + scaledHeight);
|
||||||
|
|
||||||
|
setCanvasBitmapDensity(toTransform, bitmap);
|
||||||
|
|
||||||
Canvas canvas = new Canvas(bitmap);
|
Canvas canvas = new Canvas(bitmap);
|
||||||
canvas.drawBitmap(toTransform, null, targetRect, null);
|
canvas.drawBitmap(toTransform, null, targetRect, null);
|
||||||
|
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
package jp.wasabeef.glide.transformations;
|
package jp.wasabeef.glide.transformations;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2018 Wasabeef
|
* Copyright (C) 2020 Wasabeef
|
||||||
*
|
* <p>
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
* <p>
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
* <p>
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@@ -23,12 +23,12 @@ import android.graphics.ColorMatrix;
|
|||||||
import android.graphics.ColorMatrixColorFilter;
|
import android.graphics.ColorMatrixColorFilter;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
public class GrayscaleTransformation extends BitmapTransformation {
|
public class GrayscaleTransformation extends BitmapTransformation {
|
||||||
|
|
||||||
private static final int VERSION = 1;
|
private static final int VERSION = 1;
|
||||||
@@ -45,6 +45,8 @@ public class GrayscaleTransformation extends BitmapTransformation {
|
|||||||
toTransform.getConfig() != null ? toTransform.getConfig() : Bitmap.Config.ARGB_8888;
|
toTransform.getConfig() != null ? toTransform.getConfig() : Bitmap.Config.ARGB_8888;
|
||||||
Bitmap bitmap = pool.get(width, height, config);
|
Bitmap bitmap = pool.get(width, height, config);
|
||||||
|
|
||||||
|
setCanvasBitmapDensity(toTransform, bitmap);
|
||||||
|
|
||||||
Canvas canvas = new Canvas(bitmap);
|
Canvas canvas = new Canvas(bitmap);
|
||||||
ColorMatrix saturation = new ColorMatrix();
|
ColorMatrix saturation = new ColorMatrix();
|
||||||
saturation.setSaturation(0f);
|
saturation.setSaturation(0f);
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
package jp.wasabeef.glide.transformations;
|
package jp.wasabeef.glide.transformations;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2018 Wasabeef
|
* Copyright (C) 2020 Wasabeef
|
||||||
*
|
* <p>
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
* <p>
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
* <p>
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@@ -24,21 +24,20 @@ import android.graphics.PorterDuff;
|
|||||||
import android.graphics.PorterDuffXfermode;
|
import android.graphics.PorterDuffXfermode;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import jp.wasabeef.glide.transformations.internal.Utils;
|
|
||||||
|
|
||||||
public class MaskTransformation extends BitmapTransformation {
|
public class MaskTransformation extends BitmapTransformation {
|
||||||
|
|
||||||
private static final int VERSION = 1;
|
private static final int VERSION = 1;
|
||||||
private static final String ID =
|
private static final String ID =
|
||||||
"jp.wasabeef.glide.transformations.MaskTransformation." + VERSION;
|
"jp.wasabeef.glide.transformations.MaskTransformation." + VERSION;
|
||||||
|
|
||||||
private static Paint paint = new Paint();
|
private static final Paint paint = new Paint();
|
||||||
private int maskId;
|
private final int maskId;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
|
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
|
||||||
@@ -62,7 +61,9 @@ public class MaskTransformation extends BitmapTransformation {
|
|||||||
Bitmap bitmap = pool.get(width, height, Bitmap.Config.ARGB_8888);
|
Bitmap bitmap = pool.get(width, height, Bitmap.Config.ARGB_8888);
|
||||||
bitmap.setHasAlpha(true);
|
bitmap.setHasAlpha(true);
|
||||||
|
|
||||||
Drawable mask = Utils.getMaskDrawable(context.getApplicationContext(), maskId);
|
Drawable mask = context.getDrawable(maskId);
|
||||||
|
|
||||||
|
setCanvasBitmapDensity(toTransform, bitmap);
|
||||||
|
|
||||||
Canvas canvas = new Canvas(bitmap);
|
Canvas canvas = new Canvas(bitmap);
|
||||||
mask.setBounds(0, 0, width, height);
|
mask.setBounds(0, 0, width, height);
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
package jp.wasabeef.glide.transformations;
|
package jp.wasabeef.glide.transformations;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2018 Wasabeef
|
* Copyright (C) 2020 Wasabeef
|
||||||
*
|
* <p>
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
* <p>
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
* <p>
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@@ -24,12 +24,12 @@ import android.graphics.Paint;
|
|||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
import android.graphics.Shader;
|
import android.graphics.Shader;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
public class RoundedCornersTransformation extends BitmapTransformation {
|
public class RoundedCornersTransformation extends BitmapTransformation {
|
||||||
|
|
||||||
private static final int VERSION = 1;
|
private static final int VERSION = 1;
|
||||||
@@ -43,10 +43,10 @@ public class RoundedCornersTransformation extends BitmapTransformation {
|
|||||||
DIAGONAL_FROM_TOP_LEFT, DIAGONAL_FROM_TOP_RIGHT
|
DIAGONAL_FROM_TOP_LEFT, DIAGONAL_FROM_TOP_RIGHT
|
||||||
}
|
}
|
||||||
|
|
||||||
private int radius;
|
private final int radius;
|
||||||
private int diameter;
|
private final int diameter;
|
||||||
private int margin;
|
private final int margin;
|
||||||
private CornerType cornerType;
|
private final CornerType cornerType;
|
||||||
|
|
||||||
public RoundedCornersTransformation(int radius, int margin) {
|
public RoundedCornersTransformation(int radius, int margin) {
|
||||||
this(radius, margin, CornerType.ALL);
|
this(radius, margin, CornerType.ALL);
|
||||||
@@ -68,6 +68,8 @@ public class RoundedCornersTransformation extends BitmapTransformation {
|
|||||||
Bitmap bitmap = pool.get(width, height, Bitmap.Config.ARGB_8888);
|
Bitmap bitmap = pool.get(width, height, Bitmap.Config.ARGB_8888);
|
||||||
bitmap.setHasAlpha(true);
|
bitmap.setHasAlpha(true);
|
||||||
|
|
||||||
|
setCanvasBitmapDensity(toTransform, bitmap);
|
||||||
|
|
||||||
Canvas canvas = new Canvas(bitmap);
|
Canvas canvas = new Canvas(bitmap);
|
||||||
Paint paint = new Paint();
|
Paint paint = new Paint();
|
||||||
paint.setAntiAlias(true);
|
paint.setAntiAlias(true);
|
||||||
@@ -220,8 +222,8 @@ public class RoundedCornersTransformation extends BitmapTransformation {
|
|||||||
radius, paint);
|
radius, paint);
|
||||||
canvas.drawRoundRect(new RectF(right - diameter, bottom - diameter, right, bottom), radius,
|
canvas.drawRoundRect(new RectF(right - diameter, bottom - diameter, right, bottom), radius,
|
||||||
radius, paint);
|
radius, paint);
|
||||||
canvas.drawRect(new RectF(margin, margin + radius, right - diameter, bottom), paint);
|
canvas.drawRect(new RectF(margin, margin + radius, right - radius, bottom), paint);
|
||||||
canvas.drawRect(new RectF(margin + diameter, margin, right, bottom - radius), paint);
|
canvas.drawRect(new RectF(margin + radius, margin, right, bottom - radius), paint);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawDiagonalFromTopRightRoundRect(Canvas canvas, Paint paint, float right,
|
private void drawDiagonalFromTopRightRoundRect(Canvas canvas, Paint paint, float right,
|
||||||
|
@@ -1,112 +0,0 @@
|
|||||||
package jp.wasabeef.glide.transformations;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copyright (C) 2018 Wasabeef
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.graphics.Bitmap;
|
|
||||||
import android.graphics.Canvas;
|
|
||||||
import android.graphics.Paint;
|
|
||||||
import android.os.Build;
|
|
||||||
|
|
||||||
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import jp.wasabeef.glide.transformations.internal.FastBlur;
|
|
||||||
import jp.wasabeef.glide.transformations.internal.RSBlur;
|
|
||||||
import jp.wasabeef.glide.transformations.internal.SupportRSBlur;
|
|
||||||
|
|
||||||
public class SupportRSBlurTransformation extends BitmapTransformation {
|
|
||||||
|
|
||||||
private static final int VERSION = 1;
|
|
||||||
private static final String ID =
|
|
||||||
"jp.wasabeef.glide.transformations.SupportRSBlurTransformation." + VERSION;
|
|
||||||
|
|
||||||
private static int MAX_RADIUS = 25;
|
|
||||||
private static int DEFAULT_DOWN_SAMPLING = 1;
|
|
||||||
|
|
||||||
private int radius;
|
|
||||||
private int sampling;
|
|
||||||
|
|
||||||
public SupportRSBlurTransformation() {
|
|
||||||
this(MAX_RADIUS, DEFAULT_DOWN_SAMPLING);
|
|
||||||
}
|
|
||||||
|
|
||||||
public SupportRSBlurTransformation(int radius) {
|
|
||||||
this(radius, DEFAULT_DOWN_SAMPLING);
|
|
||||||
}
|
|
||||||
|
|
||||||
public SupportRSBlurTransformation(int radius, int sampling) {
|
|
||||||
this.radius = radius;
|
|
||||||
this.sampling = sampling;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Bitmap transform(@NonNull Context context, @NonNull BitmapPool pool,
|
|
||||||
@NonNull Bitmap toTransform, int outWidth, int outHeight) {
|
|
||||||
|
|
||||||
int width = toTransform.getWidth();
|
|
||||||
int height = toTransform.getHeight();
|
|
||||||
int scaledWidth = width / sampling;
|
|
||||||
int scaledHeight = height / sampling;
|
|
||||||
|
|
||||||
Bitmap bitmap = pool.get(scaledWidth, scaledHeight, Bitmap.Config.ARGB_8888);
|
|
||||||
|
|
||||||
Canvas canvas = new Canvas(bitmap);
|
|
||||||
canvas.scale(1 / (float) sampling, 1 / (float) sampling);
|
|
||||||
Paint paint = new Paint();
|
|
||||||
paint.setFlags(Paint.FILTER_BITMAP_FLAG);
|
|
||||||
canvas.drawBitmap(toTransform, 0, 0, paint);
|
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
|
||||||
try {
|
|
||||||
bitmap = SupportRSBlur.blur(context, bitmap, radius);
|
|
||||||
} catch (NoClassDefFoundError e) {
|
|
||||||
bitmap = RSBlur.blur(context, bitmap, radius);
|
|
||||||
} catch (RuntimeException e) {
|
|
||||||
bitmap = FastBlur.blur(bitmap, radius, true);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
bitmap = FastBlur.blur(bitmap, radius, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
return bitmap;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "SupportRSBlurTransformation(radius=" + radius + ", sampling=" + sampling + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
return o instanceof SupportRSBlurTransformation &&
|
|
||||||
((SupportRSBlurTransformation) o).radius == radius &&
|
|
||||||
((SupportRSBlurTransformation) o).sampling == sampling;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return ID.hashCode() + radius * 1000 + sampling * 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
|
||||||
messageDigest.update((ID + radius + sampling).getBytes(CHARSET));
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,14 +1,14 @@
|
|||||||
package jp.wasabeef.glide.transformations.gpu;
|
package jp.wasabeef.glide.transformations.gpu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2018 Wasabeef
|
* Copyright (C) 2020 Wasabeef
|
||||||
*
|
* <p>
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
* <p>
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
* <p>
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@@ -16,9 +16,10 @@ package jp.wasabeef.glide.transformations.gpu;
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import jp.co.cyberagent.android.gpuimage.filter.GPUImageBrightnessFilter;
|
import jp.co.cyberagent.android.gpuimage.filter.GPUImageBrightnessFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,7 +31,7 @@ public class BrightnessFilterTransformation extends GPUFilterTransformation {
|
|||||||
private static final String ID =
|
private static final String ID =
|
||||||
"jp.wasabeef.glide.transformations.gpu.BrightnessFilterTransformation." + VERSION;
|
"jp.wasabeef.glide.transformations.gpu.BrightnessFilterTransformation." + VERSION;
|
||||||
|
|
||||||
private float brightness;
|
private final float brightness;
|
||||||
|
|
||||||
public BrightnessFilterTransformation() {
|
public BrightnessFilterTransformation() {
|
||||||
this(0.0f);
|
this(0.0f);
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
package jp.wasabeef.glide.transformations.gpu;
|
package jp.wasabeef.glide.transformations.gpu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2018 Wasabeef
|
* Copyright (C) 2020 Wasabeef
|
||||||
*
|
* <p>
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
* <p>
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
* <p>
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@@ -16,9 +16,10 @@ package jp.wasabeef.glide.transformations.gpu;
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import jp.co.cyberagent.android.gpuimage.filter.GPUImageContrastFilter;
|
import jp.co.cyberagent.android.gpuimage.filter.GPUImageContrastFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,7 +31,7 @@ public class ContrastFilterTransformation extends GPUFilterTransformation {
|
|||||||
private static final String ID =
|
private static final String ID =
|
||||||
"jp.wasabeef.glide.transformations.gpu.ContrastFilterTransformation." + VERSION;
|
"jp.wasabeef.glide.transformations.gpu.ContrastFilterTransformation." + VERSION;
|
||||||
|
|
||||||
private float contrast;
|
private final float contrast;
|
||||||
|
|
||||||
public ContrastFilterTransformation() {
|
public ContrastFilterTransformation() {
|
||||||
this(1.0f);
|
this(1.0f);
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
package jp.wasabeef.glide.transformations.gpu;
|
package jp.wasabeef.glide.transformations.gpu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2018 Wasabeef
|
* Copyright (C) 2020 Wasabeef
|
||||||
*
|
* <p>
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
* <p>
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
* <p>
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@@ -19,11 +19,12 @@ package jp.wasabeef.glide.transformations.gpu;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import jp.co.cyberagent.android.gpuimage.GPUImage;
|
import jp.co.cyberagent.android.gpuimage.GPUImage;
|
||||||
import jp.co.cyberagent.android.gpuimage.filter.GPUImageFilter;
|
import jp.co.cyberagent.android.gpuimage.filter.GPUImageFilter;
|
||||||
import jp.wasabeef.glide.transformations.BitmapTransformation;
|
import jp.wasabeef.glide.transformations.BitmapTransformation;
|
||||||
@@ -35,7 +36,7 @@ public class GPUFilterTransformation extends BitmapTransformation {
|
|||||||
"jp.wasabeef.glide.transformations.gpu.GPUFilterTransformation." + VERSION;
|
"jp.wasabeef.glide.transformations.gpu.GPUFilterTransformation." + VERSION;
|
||||||
private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
|
private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
|
||||||
|
|
||||||
private GPUImageFilter gpuImageFilter;
|
private final GPUImageFilter gpuImageFilter;
|
||||||
|
|
||||||
public GPUFilterTransformation(GPUImageFilter filter) {
|
public GPUFilterTransformation(GPUImageFilter filter) {
|
||||||
this.gpuImageFilter = filter;
|
this.gpuImageFilter = filter;
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
package jp.wasabeef.glide.transformations.gpu;
|
package jp.wasabeef.glide.transformations.gpu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2018 Wasabeef
|
* Copyright (C) 2020 Wasabeef
|
||||||
*
|
* <p>
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
* <p>
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
* <p>
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@@ -16,9 +16,10 @@ package jp.wasabeef.glide.transformations.gpu;
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import jp.co.cyberagent.android.gpuimage.filter.GPUImageColorInvertFilter;
|
import jp.co.cyberagent.android.gpuimage.filter.GPUImageColorInvertFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
package jp.wasabeef.glide.transformations.gpu;
|
package jp.wasabeef.glide.transformations.gpu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2018 Wasabeef
|
* Copyright (C) 2020 Wasabeef
|
||||||
*
|
* <p>
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
* <p>
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
* <p>
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@@ -16,14 +16,15 @@ package jp.wasabeef.glide.transformations.gpu;
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import jp.co.cyberagent.android.gpuimage.filter.GPUImageKuwaharaFilter;
|
import jp.co.cyberagent.android.gpuimage.filter.GPUImageKuwaharaFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Kuwahara all the colors in the image.
|
* Kuwahara all the colors in the image.
|
||||||
*
|
* <p>
|
||||||
* The radius to sample from when creating the brush-stroke effect, with a default of 25.
|
* The radius to sample from when creating the brush-stroke effect, with a default of 25.
|
||||||
* The larger the radius, the slower the filter.
|
* The larger the radius, the slower the filter.
|
||||||
*/
|
*/
|
||||||
@@ -33,7 +34,7 @@ public class KuwaharaFilterTransformation extends GPUFilterTransformation {
|
|||||||
private static final String ID =
|
private static final String ID =
|
||||||
"jp.wasabeef.glide.transformations.gpu.KuwaharaFilterTransformation." + VERSION;
|
"jp.wasabeef.glide.transformations.gpu.KuwaharaFilterTransformation." + VERSION;
|
||||||
|
|
||||||
private int radius;
|
private final int radius;
|
||||||
|
|
||||||
public KuwaharaFilterTransformation() {
|
public KuwaharaFilterTransformation() {
|
||||||
this(25);
|
this(25);
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
package jp.wasabeef.glide.transformations.gpu;
|
package jp.wasabeef.glide.transformations.gpu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2018 Wasabeef
|
* Copyright (C) 2020 Wasabeef
|
||||||
*
|
* <p>
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
* <p>
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
* <p>
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@@ -16,14 +16,15 @@ package jp.wasabeef.glide.transformations.gpu;
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import jp.co.cyberagent.android.gpuimage.filter.GPUImagePixelationFilter;
|
import jp.co.cyberagent.android.gpuimage.filter.GPUImagePixelationFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applies a Pixelation effect to the image.
|
* Applies a Pixelation effect to the image.
|
||||||
*
|
* <p>
|
||||||
* The pixel with a default of 10.0.
|
* The pixel with a default of 10.0.
|
||||||
*/
|
*/
|
||||||
public class PixelationFilterTransformation extends GPUFilterTransformation {
|
public class PixelationFilterTransformation extends GPUFilterTransformation {
|
||||||
@@ -32,7 +33,7 @@ public class PixelationFilterTransformation extends GPUFilterTransformation {
|
|||||||
private static final String ID =
|
private static final String ID =
|
||||||
"jp.wasabeef.glide.transformations.gpu.PixelationFilterTransformation." + VERSION;
|
"jp.wasabeef.glide.transformations.gpu.PixelationFilterTransformation." + VERSION;
|
||||||
|
|
||||||
private float pixel;
|
private final float pixel;
|
||||||
|
|
||||||
public PixelationFilterTransformation() {
|
public PixelationFilterTransformation() {
|
||||||
this(10f);
|
this(10f);
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package jp.wasabeef.glide.transformations.gpu;
|
package jp.wasabeef.glide.transformations.gpu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2018 Wasabeef
|
* Copyright (C) 2020 Wasabeef
|
||||||
* <p>
|
* <p>
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -16,14 +16,15 @@ package jp.wasabeef.glide.transformations.gpu;
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import jp.co.cyberagent.android.gpuimage.filter.GPUImageSepiaToneFilter;
|
import jp.co.cyberagent.android.gpuimage.filter.GPUImageSepiaToneFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applies a simple sepia effect.
|
* Applies a simple sepia effect.
|
||||||
*
|
* <p>
|
||||||
* The intensity with a default of 1.0.
|
* The intensity with a default of 1.0.
|
||||||
*/
|
*/
|
||||||
public class SepiaFilterTransformation extends GPUFilterTransformation {
|
public class SepiaFilterTransformation extends GPUFilterTransformation {
|
||||||
@@ -32,7 +33,7 @@ public class SepiaFilterTransformation extends GPUFilterTransformation {
|
|||||||
private static final String ID =
|
private static final String ID =
|
||||||
"jp.wasabeef.glide.transformations.gpu.SepiaFilterTransformation." + VERSION;
|
"jp.wasabeef.glide.transformations.gpu.SepiaFilterTransformation." + VERSION;
|
||||||
|
|
||||||
private float intensity;
|
private final float intensity;
|
||||||
|
|
||||||
public SepiaFilterTransformation() {
|
public SepiaFilterTransformation() {
|
||||||
this(1.0f);
|
this(1.0f);
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
package jp.wasabeef.glide.transformations.gpu;
|
package jp.wasabeef.glide.transformations.gpu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2018 Wasabeef
|
* Copyright (C) 2020 Wasabeef
|
||||||
*
|
* <p>
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
* <p>
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
* <p>
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@@ -16,9 +16,10 @@ package jp.wasabeef.glide.transformations.gpu;
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import jp.co.cyberagent.android.gpuimage.filter.GPUImageSketchFilter;
|
import jp.co.cyberagent.android.gpuimage.filter.GPUImageSketchFilter;
|
||||||
|
|
||||||
public class SketchFilterTransformation extends GPUFilterTransformation {
|
public class SketchFilterTransformation extends GPUFilterTransformation {
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
package jp.wasabeef.glide.transformations.gpu;
|
package jp.wasabeef.glide.transformations.gpu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2018 Wasabeef
|
* Copyright (C) 2020 Wasabeef
|
||||||
*
|
* <p>
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
* <p>
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
* <p>
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@@ -18,9 +18,10 @@ package jp.wasabeef.glide.transformations.gpu;
|
|||||||
|
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import jp.co.cyberagent.android.gpuimage.filter.GPUImageSwirlFilter;
|
import jp.co.cyberagent.android.gpuimage.filter.GPUImageSwirlFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,9 +33,9 @@ public class SwirlFilterTransformation extends GPUFilterTransformation {
|
|||||||
private static final String ID =
|
private static final String ID =
|
||||||
"jp.wasabeef.glide.transformations.gpu.SwirlFilterTransformation." + VERSION;
|
"jp.wasabeef.glide.transformations.gpu.SwirlFilterTransformation." + VERSION;
|
||||||
|
|
||||||
private float radius;
|
private final float radius;
|
||||||
private float angle;
|
private final float angle;
|
||||||
private PointF center;
|
private final PointF center;
|
||||||
|
|
||||||
public SwirlFilterTransformation() {
|
public SwirlFilterTransformation() {
|
||||||
this(.5f, 1.0f, new PointF(0.5f, 0.5f));
|
this(.5f, 1.0f, new PointF(0.5f, 0.5f));
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
package jp.wasabeef.glide.transformations.gpu;
|
package jp.wasabeef.glide.transformations.gpu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2018 Wasabeef
|
* Copyright (C) 2020 Wasabeef
|
||||||
*
|
* <p>
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
* <p>
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
* <p>
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@@ -16,9 +16,10 @@ package jp.wasabeef.glide.transformations.gpu;
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import jp.co.cyberagent.android.gpuimage.filter.GPUImageToonFilter;
|
import jp.co.cyberagent.android.gpuimage.filter.GPUImageToonFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,8 +33,8 @@ public class ToonFilterTransformation extends GPUFilterTransformation {
|
|||||||
private static final String ID =
|
private static final String ID =
|
||||||
"jp.wasabeef.glide.transformations.gpu.ToonFilterTransformation." + VERSION;
|
"jp.wasabeef.glide.transformations.gpu.ToonFilterTransformation." + VERSION;
|
||||||
|
|
||||||
private float threshold;
|
private final float threshold;
|
||||||
private float quantizationLevels;
|
private final float quantizationLevels;
|
||||||
|
|
||||||
public ToonFilterTransformation() {
|
public ToonFilterTransformation() {
|
||||||
this(.2f, 10.0f);
|
this(.2f, 10.0f);
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
package jp.wasabeef.glide.transformations.gpu;
|
package jp.wasabeef.glide.transformations.gpu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2018 Wasabeef
|
* Copyright (C) 2020 Wasabeef
|
||||||
*
|
* <p>
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
* <p>
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
* <p>
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@@ -18,10 +18,11 @@ package jp.wasabeef.glide.transformations.gpu;
|
|||||||
|
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import jp.co.cyberagent.android.gpuimage.filter.GPUImageVignetteFilter;
|
import jp.co.cyberagent.android.gpuimage.filter.GPUImageVignetteFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,10 +36,10 @@ public class VignetteFilterTransformation extends GPUFilterTransformation {
|
|||||||
private static final String ID =
|
private static final String ID =
|
||||||
"jp.wasabeef.glide.transformations.gpu.VignetteFilterTransformation." + VERSION;
|
"jp.wasabeef.glide.transformations.gpu.VignetteFilterTransformation." + VERSION;
|
||||||
|
|
||||||
private PointF center;
|
private final PointF center;
|
||||||
private float[] vignetteColor;
|
private final float[] vignetteColor;
|
||||||
private float vignetteStart;
|
private final float vignetteStart;
|
||||||
private float vignetteEnd;
|
private final float vignetteEnd;
|
||||||
|
|
||||||
public VignetteFilterTransformation() {
|
public VignetteFilterTransformation() {
|
||||||
this(new PointF(0.5f, 0.5f), new float[]{0.0f, 0.0f, 0.0f}, 0.0f, 0.75f);
|
this(new PointF(0.5f, 0.5f), new float[]{0.0f, 0.0f, 0.0f}, 0.0f, 0.75f);
|
||||||
|
@@ -3,14 +3,14 @@ package jp.wasabeef.glide.transformations.internal;
|
|||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2018 Wasabeef
|
* Copyright (C) 2020 Wasabeef
|
||||||
*
|
* <p>
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
* <p>
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
* <p>
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@@ -72,15 +72,15 @@ public class FastBlur {
|
|||||||
int wh = w * h;
|
int wh = w * h;
|
||||||
int div = radius + radius + 1;
|
int div = radius + radius + 1;
|
||||||
|
|
||||||
int r[] = new int[wh];
|
int[] r = new int[wh];
|
||||||
int g[] = new int[wh];
|
int[] g = new int[wh];
|
||||||
int b[] = new int[wh];
|
int[] b = new int[wh];
|
||||||
int rsum, gsum, bsum, x, y, i, p, yp, yi, yw;
|
int rsum, gsum, bsum, x, y, i, p, yp, yi, yw;
|
||||||
int vmin[] = new int[Math.max(w, h)];
|
int[] vmin = new int[Math.max(w, h)];
|
||||||
|
|
||||||
int divsum = (div + 1) >> 1;
|
int divsum = (div + 1) >> 1;
|
||||||
divsum *= divsum;
|
divsum *= divsum;
|
||||||
int dv[] = new int[256 * divsum];
|
int[] dv = new int[256 * divsum];
|
||||||
for (i = 0; i < 256 * divsum; i++) {
|
for (i = 0; i < 256 * divsum; i++) {
|
||||||
dv[i] = (i / divsum);
|
dv[i] = (i / divsum);
|
||||||
}
|
}
|
||||||
|
@@ -11,14 +11,14 @@ import android.renderscript.RenderScript;
|
|||||||
import android.renderscript.ScriptIntrinsicBlur;
|
import android.renderscript.ScriptIntrinsicBlur;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2018 Wasabeef
|
* Copyright (C) 2020 Wasabeef
|
||||||
*
|
* <p>
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
* <p>
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
* <p>
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@@ -28,7 +28,6 @@ import android.renderscript.ScriptIntrinsicBlur;
|
|||||||
|
|
||||||
public class RSBlur {
|
public class RSBlur {
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
|
|
||||||
public static Bitmap blur(Context context, Bitmap bitmap, int radius) throws RSRuntimeException {
|
public static Bitmap blur(Context context, Bitmap bitmap, int radius) throws RSRuntimeException {
|
||||||
RenderScript rs = null;
|
RenderScript rs = null;
|
||||||
Allocation input = null;
|
Allocation input = null;
|
||||||
|
@@ -1,71 +0,0 @@
|
|||||||
package jp.wasabeef.glide.transformations.internal;
|
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.graphics.Bitmap;
|
|
||||||
import android.os.Build;
|
|
||||||
|
|
||||||
import androidx.renderscript.Allocation;
|
|
||||||
import androidx.renderscript.Element;
|
|
||||||
import androidx.renderscript.RSRuntimeException;
|
|
||||||
import androidx.renderscript.RenderScript;
|
|
||||||
import androidx.renderscript.ScriptIntrinsicBlur;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copyright (C) 2018 Wasabeef
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class SupportRSBlur {
|
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
|
|
||||||
public static Bitmap blur(Context context, Bitmap bitmap, int radius) throws RSRuntimeException {
|
|
||||||
RenderScript rs = null;
|
|
||||||
Allocation input = null;
|
|
||||||
Allocation output = null;
|
|
||||||
ScriptIntrinsicBlur blur = null;
|
|
||||||
try {
|
|
||||||
rs = RenderScript.create(context);
|
|
||||||
rs.setMessageHandler(new RenderScript.RSMessageHandler());
|
|
||||||
input = Allocation.createFromBitmap(rs, bitmap, Allocation.MipmapControl.MIPMAP_NONE,
|
|
||||||
Allocation.USAGE_SCRIPT);
|
|
||||||
output = Allocation.createTyped(rs, input.getType());
|
|
||||||
blur = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
|
|
||||||
|
|
||||||
blur.setInput(input);
|
|
||||||
blur.setRadius(radius);
|
|
||||||
blur.forEach(output);
|
|
||||||
output.copyTo(bitmap);
|
|
||||||
} finally {
|
|
||||||
if (rs != null) {
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
||||||
RenderScript.releaseAllContexts();
|
|
||||||
} else {
|
|
||||||
rs.destroy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (input != null) {
|
|
||||||
input.destroy();
|
|
||||||
}
|
|
||||||
if (output != null) {
|
|
||||||
output.destroy();
|
|
||||||
}
|
|
||||||
if (blur != null) {
|
|
||||||
blur.destroy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return bitmap;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,18 +1,19 @@
|
|||||||
package jp.wasabeef.glide.transformations.internal;
|
package jp.wasabeef.glide.transformations.internal;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2018 Wasabeef
|
* Copyright (C) 2020 Wasabeef
|
||||||
*
|
* <p>
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
* <p>
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
* <p>
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@@ -26,18 +27,7 @@ public final class Utils {
|
|||||||
// Utility class.
|
// Utility class.
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Drawable getMaskDrawable(Context context, int maskId) {
|
public static int toDp(int px) {
|
||||||
Drawable drawable;
|
return px * (int) Resources.getSystem().getDisplayMetrics().density;
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
||||||
drawable = context.getDrawable(maskId);
|
|
||||||
} else {
|
|
||||||
drawable = context.getResources().getDrawable(maskId);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (drawable == null) {
|
|
||||||
throw new IllegalArgumentException("maskId is invalid");
|
|
||||||
}
|
|
||||||
|
|
||||||
return drawable;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user