mirror of
https://github.com/wasabeef/glide-transformations.git
synced 2025-08-08 12:39:34 +08:00
v3.3.0 (#127)
* fixed #119 * update gradle files * rename * add sample of SupportRSBlur * update libs * bump up 3.3.0
This commit is contained in:
parent
8c72ad64b9
commit
4818373fc5
15
CHANGELOG.md
15
CHANGELOG.md
@ -1,6 +1,21 @@
|
|||||||
Change Log
|
Change Log
|
||||||
==========
|
==========
|
||||||
|
|
||||||
|
Version 3.3.0 *(2018-04-23)*
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
Update:
|
||||||
|
- Support Library 27.1.0 -> 27.1.1
|
||||||
|
- Glide 4.6.1 -> 4.7.1
|
||||||
|
|
||||||
|
Feature:
|
||||||
|
- SupportRSBlurTransformation [#125](https://github.com/wasabeef/glide-transformations/pull/125)
|
||||||
|
it's using RenderScript support mode but can you choose to use or not.
|
||||||
|
Thank you [@fougere-mike](https://github.com/fougere-mike)
|
||||||
|
|
||||||
|
Bug Fix:
|
||||||
|
- Set detail of Cache key [#119](https://github.com/wasabeef/glide-transformations/issues/119)
|
||||||
|
|
||||||
Version 3.2.0 *(2018-04-10)*
|
Version 3.2.0 *(2018-04-10)*
|
||||||
----------------------------
|
----------------------------
|
||||||
|
|
||||||
|
17
README.md
17
README.md
@ -32,7 +32,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'jp.wasabeef:glide-transformations:3.2.0'
|
implementation 'jp.wasabeef:glide-transformations:3.3.0'
|
||||||
// If you want to use the GPU Filters
|
// If you want to use the GPU Filters
|
||||||
implementation 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.4.1'
|
implementation 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.4.1'
|
||||||
}
|
}
|
||||||
@ -61,6 +61,21 @@ Glide.with(this).load(R.drawable.demo)
|
|||||||
.into((ImageView) findViewById(R.id.image));
|
.into((ImageView) findViewById(R.id.image));
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# Step 4
|
||||||
|
|
||||||
|
If you are using `SupportRSBlurTransformation`.
|
||||||
|
|
||||||
|
```groovy
|
||||||
|
android {
|
||||||
|
...
|
||||||
|
defaultConfig {
|
||||||
|
...
|
||||||
|
renderscriptTargetApi YOUR_TARGET_SDK_VERSION as int
|
||||||
|
renderscriptSupportModeEnabled true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Transformations
|
## Transformations
|
||||||
|
|
||||||
### Crop
|
### Crop
|
||||||
|
@ -6,7 +6,7 @@ buildscript {
|
|||||||
google()
|
google()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.1.0'
|
classpath 'com.android.tools.build:gradle:3.1.1'
|
||||||
classpath 'com.novoda:bintray-release:0.8.1'
|
classpath 'com.novoda:bintray-release:0.8.1'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,9 @@ android {
|
|||||||
targetSdkVersion TARGET_SDK_VERSION as int
|
targetSdkVersion TARGET_SDK_VERSION as int
|
||||||
versionCode "git rev-list origin/master --count".execute().text.toInteger()
|
versionCode "git rev-list origin/master --count".execute().text.toInteger()
|
||||||
versionName VERSION_NAME
|
versionName VERSION_NAME
|
||||||
|
|
||||||
|
renderscriptTargetApi TARGET_SDK_VERSION as int
|
||||||
|
renderscriptSupportModeEnabled true
|
||||||
}
|
}
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
@ -59,5 +62,5 @@ dependencies {
|
|||||||
implementation "jp.co.cyberagent.android.gpuimage:gpuimage-library:${GPUIMAGE_VERSION}"
|
implementation "jp.co.cyberagent.android.gpuimage:gpuimage-library:${GPUIMAGE_VERSION}"
|
||||||
implementation "com.android.support:appcompat-v7:${SUPPORT_PACKAGE_VERSION}"
|
implementation "com.android.support:appcompat-v7:${SUPPORT_PACKAGE_VERSION}"
|
||||||
implementation "com.android.support:recyclerview-v7:${SUPPORT_PACKAGE_VERSION}"
|
implementation "com.android.support:recyclerview-v7:${SUPPORT_PACKAGE_VERSION}"
|
||||||
implementation 'com.android.support.constraint:constraint-layout:1.1.0-beta4'
|
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
dataSet.add(Type.Grayscale);
|
dataSet.add(Type.Grayscale);
|
||||||
dataSet.add(Type.RoundedCorners);
|
dataSet.add(Type.RoundedCorners);
|
||||||
dataSet.add(Type.Blur);
|
dataSet.add(Type.Blur);
|
||||||
|
dataSet.add(Type.SupportRSBlur);
|
||||||
dataSet.add(Type.Toon);
|
dataSet.add(Type.Toon);
|
||||||
dataSet.add(Type.Sepia);
|
dataSet.add(Type.Sepia);
|
||||||
dataSet.add(Type.Contrast);
|
dataSet.add(Type.Contrast);
|
||||||
|
@ -9,10 +9,13 @@ import android.view.View;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
import com.bumptech.glide.load.MultiTransformation;
|
import com.bumptech.glide.load.MultiTransformation;
|
||||||
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
|
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import jp.wasabeef.glide.transformations.BlurTransformation;
|
import jp.wasabeef.glide.transformations.BlurTransformation;
|
||||||
import jp.wasabeef.glide.transformations.ColorFilterTransformation;
|
import jp.wasabeef.glide.transformations.ColorFilterTransformation;
|
||||||
import jp.wasabeef.glide.transformations.CropCircleTransformation;
|
import jp.wasabeef.glide.transformations.CropCircleTransformation;
|
||||||
@ -22,6 +25,7 @@ import jp.wasabeef.glide.transformations.CropTransformation.CropType;
|
|||||||
import jp.wasabeef.glide.transformations.GrayscaleTransformation;
|
import jp.wasabeef.glide.transformations.GrayscaleTransformation;
|
||||||
import jp.wasabeef.glide.transformations.MaskTransformation;
|
import jp.wasabeef.glide.transformations.MaskTransformation;
|
||||||
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
||||||
|
import jp.wasabeef.glide.transformations.SupportRSBlurTransformation;
|
||||||
import jp.wasabeef.glide.transformations.gpu.BrightnessFilterTransformation;
|
import jp.wasabeef.glide.transformations.gpu.BrightnessFilterTransformation;
|
||||||
import jp.wasabeef.glide.transformations.gpu.ContrastFilterTransformation;
|
import jp.wasabeef.glide.transformations.gpu.ContrastFilterTransformation;
|
||||||
import jp.wasabeef.glide.transformations.gpu.InvertFilterTransformation;
|
import jp.wasabeef.glide.transformations.gpu.InvertFilterTransformation;
|
||||||
@ -56,6 +60,7 @@ public class MainAdapter extends RecyclerView.Adapter<MainAdapter.ViewHolder> {
|
|||||||
Grayscale,
|
Grayscale,
|
||||||
RoundedCorners,
|
RoundedCorners,
|
||||||
Blur,
|
Blur,
|
||||||
|
SupportRSBlur,
|
||||||
Toon,
|
Toon,
|
||||||
Sepia,
|
Sepia,
|
||||||
Contrast,
|
Contrast,
|
||||||
@ -163,6 +168,12 @@ public class MainAdapter extends RecyclerView.Adapter<MainAdapter.ViewHolder> {
|
|||||||
.apply(bitmapTransform(new BlurTransformation(25)))
|
.apply(bitmapTransform(new BlurTransformation(25)))
|
||||||
.into(holder.image);
|
.into(holder.image);
|
||||||
break;
|
break;
|
||||||
|
case SupportRSBlur:
|
||||||
|
Glide.with(context)
|
||||||
|
.load(R.drawable.check)
|
||||||
|
.apply(bitmapTransform(new SupportRSBlurTransformation(25, 10)))
|
||||||
|
.into(holder.image);
|
||||||
|
break;
|
||||||
case Toon:
|
case Toon:
|
||||||
Glide.with(context)
|
Glide.with(context)
|
||||||
.load(R.drawable.demo)
|
.load(R.drawable.demo)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
VERSION_NAME=3.2.0
|
VERSION_NAME=3.3.0
|
||||||
GROUP=jp.wasabeef
|
GROUP=jp.wasabeef
|
||||||
ARTIFACT_ID=glide-transformations
|
ARTIFACT_ID=glide-transformations
|
||||||
|
|
||||||
@ -21,6 +21,6 @@ POM_DEVELOPER_EMAIL=dadadada.chop@gmail.com
|
|||||||
POM_DEVELOPER_URL=wasabeef.jp
|
POM_DEVELOPER_URL=wasabeef.jp
|
||||||
ISSUE_URL=https://github.com/wasabeef/glide-transformations/issues
|
ISSUE_URL=https://github.com/wasabeef/glide-transformations/issues
|
||||||
|
|
||||||
SUPPORT_PACKAGE_VERSION=27.1.0
|
SUPPORT_PACKAGE_VERSION=27.1.1
|
||||||
GLIDE_VERSION=4.6.1
|
GLIDE_VERSION=4.7.1
|
||||||
GPUIMAGE_VERSION=1.4.1
|
GPUIMAGE_VERSION=1.4.1
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,5 @@
|
|||||||
#Tue Apr 10 02:12:33 JST 2018
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-bin.zip
|
||||||
|
@ -31,9 +31,10 @@ import java.security.MessageDigest;
|
|||||||
|
|
||||||
public abstract class BitmapTransformation implements Transformation<Bitmap> {
|
public abstract class BitmapTransformation implements Transformation<Bitmap> {
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public final Resource<Bitmap> transform(Context context, Resource<Bitmap> resource, int outWidth,
|
public final Resource<Bitmap> transform(@NonNull Context context, @NonNull Resource<Bitmap> resource,
|
||||||
int outHeight) {
|
int outWidth, int outHeight) {
|
||||||
if (!Util.isValidDimensions(outWidth, outHeight)) {
|
if (!Util.isValidDimensions(outWidth, outHeight)) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Cannot apply transformation on width: " + outWidth + " or height: " + outHeight
|
"Cannot apply transformation on width: " + outWidth + " or height: " + outHeight
|
||||||
@ -57,7 +58,7 @@ public abstract class BitmapTransformation implements Transformation<Bitmap> {
|
|||||||
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);
|
||||||
|
|
||||||
@Override public abstract void updateDiskCacheKey(MessageDigest messageDigest);
|
@Override public abstract void updateDiskCacheKey(@NonNull MessageDigest messageDigest);
|
||||||
|
|
||||||
@Override public abstract boolean equals(Object o);
|
@Override public abstract boolean equals(Object o);
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@ public class BlurTransformation 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.BlurTransformation." + VERSION;
|
"jp.wasabeef.glide.transformations.BlurTransformation." + VERSION;
|
||||||
private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
|
|
||||||
|
|
||||||
private static int MAX_RADIUS = 25;
|
private static int MAX_RADIUS = 25;
|
||||||
private static int DEFAULT_DOWN_SAMPLING = 1;
|
private static int DEFAULT_DOWN_SAMPLING = 1;
|
||||||
@ -80,14 +79,16 @@ public class BlurTransformation extends BitmapTransformation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean equals(Object o) {
|
@Override public boolean equals(Object o) {
|
||||||
return o instanceof BlurTransformation;
|
return o instanceof BlurTransformation &&
|
||||||
|
((BlurTransformation) o).radius == radius &&
|
||||||
|
((BlurTransformation) o).sampling == sampling;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public int hashCode() {
|
@Override public int hashCode() {
|
||||||
return ID.hashCode();
|
return ID.hashCode() + radius * 1000 + sampling * 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
|
@Override public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
||||||
messageDigest.update(ID_BYTES);
|
messageDigest.update((ID + radius + sampling).getBytes(CHARSET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,6 @@ 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 static final byte[] ID_BYTES = ID.getBytes(CHARSET);
|
|
||||||
|
|
||||||
private int color;
|
private int color;
|
||||||
|
|
||||||
@ -62,14 +61,15 @@ public class ColorFilterTransformation extends BitmapTransformation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean equals(Object o) {
|
@Override public boolean equals(Object o) {
|
||||||
return o instanceof ColorFilterTransformation;
|
return o instanceof ColorFilterTransformation &&
|
||||||
|
((ColorFilterTransformation) o).color == color;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public int hashCode() {
|
@Override public int hashCode() {
|
||||||
return ID.hashCode();
|
return ID.hashCode() + color * 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
|
@Override public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
||||||
messageDigest.update(ID_BYTES);
|
messageDigest.update((ID + color).getBytes(CHARSET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,6 @@ public class CropCircleTransformation 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.CropCircleTransformation." + VERSION;
|
"jp.wasabeef.glide.transformations.CropCircleTransformation." + VERSION;
|
||||||
private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
|
|
||||||
|
|
||||||
@Override protected Bitmap transform(@NonNull Context context, @NonNull BitmapPool pool,
|
@Override protected Bitmap transform(@NonNull Context context, @NonNull BitmapPool pool,
|
||||||
@NonNull Bitmap toTransform, int outWidth, int outHeight) {
|
@NonNull Bitmap toTransform, int outWidth, int outHeight) {
|
||||||
@ -52,7 +51,7 @@ public class CropCircleTransformation extends BitmapTransformation {
|
|||||||
return ID.hashCode();
|
return ID.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
|
@Override public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
||||||
messageDigest.update(ID_BYTES);
|
messageDigest.update((ID).getBytes(CHARSET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,6 @@ public class CropSquareTransformation 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.CropSquareTransformation." + VERSION;
|
"jp.wasabeef.glide.transformations.CropSquareTransformation." + VERSION;
|
||||||
private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
|
|
||||||
|
|
||||||
private int size;
|
private int size;
|
||||||
|
|
||||||
@ -43,14 +42,14 @@ public class CropSquareTransformation extends BitmapTransformation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean equals(Object o) {
|
@Override public boolean equals(Object o) {
|
||||||
return o instanceof CropSquareTransformation;
|
return o instanceof CropSquareTransformation && ((CropSquareTransformation) o).size == size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public int hashCode() {
|
@Override public int hashCode() {
|
||||||
return ID.hashCode();
|
return ID.hashCode() + size * 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
|
@Override public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
||||||
messageDigest.update(ID_BYTES);
|
messageDigest.update((ID + size).getBytes(CHARSET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,6 @@ public class CropTransformation extends BitmapTransformation {
|
|||||||
|
|
||||||
private static final int VERSION = 1;
|
private static final int VERSION = 1;
|
||||||
private static final String ID = "jp.wasabeef.glide.transformations.CropTransformation." + VERSION;
|
private static final String ID = "jp.wasabeef.glide.transformations.CropTransformation." + VERSION;
|
||||||
private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
|
|
||||||
|
|
||||||
public enum CropType {
|
public enum CropType {
|
||||||
TOP,
|
TOP,
|
||||||
@ -79,23 +78,6 @@ public class CropTransformation extends BitmapTransformation {
|
|||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public String toString() {
|
|
||||||
return "CropTransformation(width=" + width + ", height=" + height + ", cropType=" + cropType
|
|
||||||
+ ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public boolean equals(Object o) {
|
|
||||||
return o instanceof CropTransformation;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public int hashCode() {
|
|
||||||
return ID.hashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
|
|
||||||
messageDigest.update(ID_BYTES);
|
|
||||||
}
|
|
||||||
|
|
||||||
private float getTop(float scaledHeight) {
|
private float getTop(float scaledHeight) {
|
||||||
switch (cropType) {
|
switch (cropType) {
|
||||||
case TOP:
|
case TOP:
|
||||||
@ -108,4 +90,23 @@ public class CropTransformation extends BitmapTransformation {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override public String toString() {
|
||||||
|
return "CropTransformation(width=" + width + ", height=" + height + ", cropType=" + cropType + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public boolean equals(Object o) {
|
||||||
|
return o instanceof CropTransformation &&
|
||||||
|
((CropTransformation) o).width == width &&
|
||||||
|
((CropTransformation) o).height == height &&
|
||||||
|
((CropTransformation) o).cropType == cropType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public int hashCode() {
|
||||||
|
return ID.hashCode() + width * 100000 + height * 1000 + cropType.ordinal() * 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
||||||
|
messageDigest.update((ID + width + height + cropType).getBytes(CHARSET));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,6 @@ public class GrayscaleTransformation 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.GrayscaleTransformation." + VERSION;
|
"jp.wasabeef.glide.transformations.GrayscaleTransformation." + VERSION;
|
||||||
private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
|
|
||||||
|
|
||||||
@Override protected Bitmap transform(@NonNull Context context, @NonNull BitmapPool pool,
|
@Override protected Bitmap transform(@NonNull Context context, @NonNull BitmapPool pool,
|
||||||
@NonNull Bitmap toTransform, int outWidth, int outHeight) {
|
@NonNull Bitmap toTransform, int outWidth, int outHeight) {
|
||||||
@ -64,7 +63,7 @@ public class GrayscaleTransformation extends BitmapTransformation {
|
|||||||
return ID.hashCode();
|
return ID.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
|
@Override public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
||||||
messageDigest.update(ID_BYTES);
|
messageDigest.update((ID).getBytes(CHARSET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,6 @@ 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 final byte[] ID_BYTES = ID.getBytes(CHARSET);
|
|
||||||
|
|
||||||
private static Paint paint = new Paint();
|
private static Paint paint = new Paint();
|
||||||
private int maskId;
|
private int maskId;
|
||||||
@ -74,14 +73,15 @@ public class MaskTransformation extends BitmapTransformation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean equals(Object o) {
|
@Override public boolean equals(Object o) {
|
||||||
return o instanceof MaskTransformation;
|
return o instanceof MaskTransformation &&
|
||||||
|
((MaskTransformation) o).maskId == maskId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public int hashCode() {
|
@Override public int hashCode() {
|
||||||
return ID.hashCode();
|
return ID.hashCode() + maskId * 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
|
@Override public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
||||||
messageDigest.update(ID_BYTES);
|
messageDigest.update((ID + maskId).getBytes(CHARSET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,6 @@ public class RoundedCornersTransformation extends BitmapTransformation {
|
|||||||
|
|
||||||
private static final int VERSION = 1;
|
private static final int VERSION = 1;
|
||||||
private static final String ID = "jp.wasabeef.glide.transformations.RoundedCornersTransformation." + VERSION;
|
private static final String ID = "jp.wasabeef.glide.transformations.RoundedCornersTransformation." + VERSION;
|
||||||
private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
|
|
||||||
|
|
||||||
public enum CornerType {
|
public enum CornerType {
|
||||||
ALL,
|
ALL,
|
||||||
@ -238,14 +237,18 @@ public class RoundedCornersTransformation extends BitmapTransformation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean equals(Object o) {
|
@Override public boolean equals(Object o) {
|
||||||
return o instanceof RoundedCornersTransformation;
|
return o instanceof RoundedCornersTransformation &&
|
||||||
|
((RoundedCornersTransformation) o).radius == radius &&
|
||||||
|
((RoundedCornersTransformation) o).diameter == diameter &&
|
||||||
|
((RoundedCornersTransformation) o).margin == margin &&
|
||||||
|
((RoundedCornersTransformation) o).cornerType == cornerType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public int hashCode() {
|
@Override public int hashCode() {
|
||||||
return ID.hashCode();
|
return ID.hashCode() + radius * 10000 + diameter * 1000 + margin * 100 + cornerType.ordinal() * 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
|
@Override public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
||||||
messageDigest.update(ID_BYTES);
|
messageDigest.update((ID + radius + diameter + margin + cornerType).getBytes(CHARSET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,12 +28,11 @@ import java.security.MessageDigest;
|
|||||||
import jp.wasabeef.glide.transformations.internal.FastBlur;
|
import jp.wasabeef.glide.transformations.internal.FastBlur;
|
||||||
import jp.wasabeef.glide.transformations.internal.SupportRSBlur;
|
import jp.wasabeef.glide.transformations.internal.SupportRSBlur;
|
||||||
|
|
||||||
public class SupportBlurTransformation extends BitmapTransformation {
|
public class SupportRSBlurTransformation 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.SupportBlurTransformation." + VERSION;
|
"jp.wasabeef.glide.transformations.SupportRSBlurTransformation." + VERSION;
|
||||||
private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
|
|
||||||
|
|
||||||
private static int MAX_RADIUS = 25;
|
private static int MAX_RADIUS = 25;
|
||||||
private static int DEFAULT_DOWN_SAMPLING = 1;
|
private static int DEFAULT_DOWN_SAMPLING = 1;
|
||||||
@ -41,15 +40,15 @@ public class SupportBlurTransformation extends BitmapTransformation {
|
|||||||
private int radius;
|
private int radius;
|
||||||
private int sampling;
|
private int sampling;
|
||||||
|
|
||||||
public SupportBlurTransformation() {
|
public SupportRSBlurTransformation() {
|
||||||
this(MAX_RADIUS, DEFAULT_DOWN_SAMPLING);
|
this(MAX_RADIUS, DEFAULT_DOWN_SAMPLING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SupportBlurTransformation(int radius) {
|
public SupportRSBlurTransformation(int radius) {
|
||||||
this(radius, DEFAULT_DOWN_SAMPLING);
|
this(radius, DEFAULT_DOWN_SAMPLING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SupportBlurTransformation(int radius, int sampling) {
|
public SupportRSBlurTransformation(int radius, int sampling) {
|
||||||
this.radius = radius;
|
this.radius = radius;
|
||||||
this.sampling = sampling;
|
this.sampling = sampling;
|
||||||
}
|
}
|
||||||
@ -84,18 +83,20 @@ public class SupportBlurTransformation extends BitmapTransformation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public String toString() {
|
@Override public String toString() {
|
||||||
return "SupportBlurTransformation(radius=" + radius + ", sampling=" + sampling + ")";
|
return "SupportRSBlurTransformation(radius=" + radius + ", sampling=" + sampling + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean equals(Object o) {
|
@Override public boolean equals(Object o) {
|
||||||
return o instanceof SupportBlurTransformation;
|
return o instanceof SupportRSBlurTransformation &&
|
||||||
|
((SupportRSBlurTransformation) o).radius == radius &&
|
||||||
|
((SupportRSBlurTransformation) o).sampling == sampling;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public int hashCode() {
|
@Override public int hashCode() {
|
||||||
return ID.hashCode();
|
return ID.hashCode() + radius * 1000 + sampling * 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
|
@Override public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
||||||
messageDigest.update(ID_BYTES);
|
messageDigest.update((ID + radius + sampling).getBytes(CHARSET));
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -16,6 +16,8 @@ package jp.wasabeef.glide.transformations.gpu;
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import jp.co.cyberagent.android.gpuimage.GPUImageBrightnessFilter;
|
import jp.co.cyberagent.android.gpuimage.GPUImageBrightnessFilter;
|
||||||
|
|
||||||
@ -27,7 +29,6 @@ public class BrightnessFilterTransformation extends GPUFilterTransformation {
|
|||||||
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.gpu.BrightnessFilterTransformation." + VERSION;
|
"jp.wasabeef.glide.transformations.gpu.BrightnessFilterTransformation." + VERSION;
|
||||||
private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
|
|
||||||
|
|
||||||
private float brightness;
|
private float brightness;
|
||||||
|
|
||||||
@ -47,14 +48,15 @@ public class BrightnessFilterTransformation extends GPUFilterTransformation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean equals(Object o) {
|
@Override public boolean equals(Object o) {
|
||||||
return o instanceof BrightnessFilterTransformation;
|
return o instanceof BrightnessFilterTransformation &&
|
||||||
|
((BrightnessFilterTransformation) o).brightness == brightness;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public int hashCode() {
|
@Override public int hashCode() {
|
||||||
return ID.hashCode();
|
return ID.hashCode() + (int) ((brightness + 1.0f) * 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
|
@Override public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
||||||
messageDigest.update(ID_BYTES);
|
messageDigest.update((ID + brightness).getBytes(CHARSET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,8 @@ package jp.wasabeef.glide.transformations.gpu;
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import jp.co.cyberagent.android.gpuimage.GPUImageContrastFilter;
|
import jp.co.cyberagent.android.gpuimage.GPUImageContrastFilter;
|
||||||
|
|
||||||
@ -27,7 +29,6 @@ public class ContrastFilterTransformation extends GPUFilterTransformation {
|
|||||||
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.gpu.ContrastFilterTransformation." + VERSION;
|
"jp.wasabeef.glide.transformations.gpu.ContrastFilterTransformation." + VERSION;
|
||||||
private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
|
|
||||||
|
|
||||||
private float contrast;
|
private float contrast;
|
||||||
|
|
||||||
@ -51,10 +52,10 @@ public class ContrastFilterTransformation extends GPUFilterTransformation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public int hashCode() {
|
@Override public int hashCode() {
|
||||||
return ID.hashCode();
|
return ID.hashCode() + (int) (contrast * 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
|
@Override public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
||||||
messageDigest.update(ID_BYTES);
|
messageDigest.update((ID + contrast).getBytes(CHARSET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ public class GPUFilterTransformation extends BitmapTransformation {
|
|||||||
return ID.hashCode();
|
return ID.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
|
@Override public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
||||||
messageDigest.update(ID_BYTES);
|
messageDigest.update(ID_BYTES);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,8 @@ package jp.wasabeef.glide.transformations.gpu;
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import jp.co.cyberagent.android.gpuimage.GPUImageColorInvertFilter;
|
import jp.co.cyberagent.android.gpuimage.GPUImageColorInvertFilter;
|
||||||
|
|
||||||
@ -27,7 +29,6 @@ public class InvertFilterTransformation extends GPUFilterTransformation {
|
|||||||
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.gpu.InvertFilterTransformation." + VERSION;
|
"jp.wasabeef.glide.transformations.gpu.InvertFilterTransformation." + VERSION;
|
||||||
private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
|
|
||||||
|
|
||||||
public InvertFilterTransformation() {
|
public InvertFilterTransformation() {
|
||||||
super(new GPUImageColorInvertFilter());
|
super(new GPUImageColorInvertFilter());
|
||||||
@ -45,7 +46,7 @@ public class InvertFilterTransformation extends GPUFilterTransformation {
|
|||||||
return ID.hashCode();
|
return ID.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
|
@Override public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
||||||
messageDigest.update(ID_BYTES);
|
messageDigest.update((ID).getBytes(CHARSET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,8 @@ package jp.wasabeef.glide.transformations.gpu;
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import jp.co.cyberagent.android.gpuimage.GPUImageKuwaharaFilter;
|
import jp.co.cyberagent.android.gpuimage.GPUImageKuwaharaFilter;
|
||||||
|
|
||||||
@ -30,7 +32,6 @@ public class KuwaharaFilterTransformation extends GPUFilterTransformation {
|
|||||||
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.gpu.KuwaharaFilterTransformation." + VERSION;
|
"jp.wasabeef.glide.transformations.gpu.KuwaharaFilterTransformation." + VERSION;
|
||||||
private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
|
|
||||||
|
|
||||||
private int radius;
|
private int radius;
|
||||||
|
|
||||||
@ -54,10 +55,10 @@ public class KuwaharaFilterTransformation extends GPUFilterTransformation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public int hashCode() {
|
@Override public int hashCode() {
|
||||||
return ID.hashCode();
|
return ID.hashCode() + radius * 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
|
@Override public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
||||||
messageDigest.update(ID_BYTES);
|
messageDigest.update((ID + radius).getBytes(CHARSET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,8 @@ package jp.wasabeef.glide.transformations.gpu;
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import jp.co.cyberagent.android.gpuimage.GPUImagePixelationFilter;
|
import jp.co.cyberagent.android.gpuimage.GPUImagePixelationFilter;
|
||||||
|
|
||||||
@ -29,7 +31,6 @@ public class PixelationFilterTransformation extends GPUFilterTransformation {
|
|||||||
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.gpu.PixelationFilterTransformation." + VERSION;
|
"jp.wasabeef.glide.transformations.gpu.PixelationFilterTransformation." + VERSION;
|
||||||
private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
|
|
||||||
|
|
||||||
private float pixel;
|
private float pixel;
|
||||||
|
|
||||||
@ -53,10 +54,10 @@ public class PixelationFilterTransformation extends GPUFilterTransformation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public int hashCode() {
|
@Override public int hashCode() {
|
||||||
return ID.hashCode();
|
return ID.hashCode() + (int) (pixel * 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
|
@Override public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
||||||
messageDigest.update(ID_BYTES);
|
messageDigest.update((ID + pixel).getBytes(CHARSET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,8 @@ package jp.wasabeef.glide.transformations.gpu;
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import jp.co.cyberagent.android.gpuimage.GPUImageSepiaFilter;
|
import jp.co.cyberagent.android.gpuimage.GPUImageSepiaFilter;
|
||||||
|
|
||||||
@ -29,7 +31,6 @@ public class SepiaFilterTransformation extends GPUFilterTransformation {
|
|||||||
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.gpu.SepiaFilterTransformation." + VERSION;
|
"jp.wasabeef.glide.transformations.gpu.SepiaFilterTransformation." + VERSION;
|
||||||
private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
|
|
||||||
|
|
||||||
private float intensity;
|
private float intensity;
|
||||||
|
|
||||||
@ -53,10 +54,10 @@ public class SepiaFilterTransformation extends GPUFilterTransformation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public int hashCode() {
|
@Override public int hashCode() {
|
||||||
return ID.hashCode();
|
return ID.hashCode() + (int) (intensity * 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
|
@Override public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
||||||
messageDigest.update(ID_BYTES);
|
messageDigest.update((ID + intensity).getBytes(CHARSET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,8 @@ package jp.wasabeef.glide.transformations.gpu;
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import jp.co.cyberagent.android.gpuimage.GPUImageSketchFilter;
|
import jp.co.cyberagent.android.gpuimage.GPUImageSketchFilter;
|
||||||
|
|
||||||
@ -24,7 +26,6 @@ public class SketchFilterTransformation extends GPUFilterTransformation {
|
|||||||
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.gpu.SketchFilterTransformation." + VERSION;
|
"jp.wasabeef.glide.transformations.gpu.SketchFilterTransformation." + VERSION;
|
||||||
private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
|
|
||||||
|
|
||||||
public SketchFilterTransformation() {
|
public SketchFilterTransformation() {
|
||||||
super(new GPUImageSketchFilter());
|
super(new GPUImageSketchFilter());
|
||||||
@ -42,7 +43,7 @@ public class SketchFilterTransformation extends GPUFilterTransformation {
|
|||||||
return ID.hashCode();
|
return ID.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
|
@Override public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
||||||
messageDigest.update(ID_BYTES);
|
messageDigest.update((ID).getBytes(CHARSET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,8 @@ package jp.wasabeef.glide.transformations.gpu;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import jp.co.cyberagent.android.gpuimage.GPUImageSwirlFilter;
|
import jp.co.cyberagent.android.gpuimage.GPUImageSwirlFilter;
|
||||||
|
|
||||||
@ -28,7 +30,6 @@ public class SwirlFilterTransformation extends GPUFilterTransformation {
|
|||||||
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.gpu.SwirlFilterTransformation." + VERSION;
|
"jp.wasabeef.glide.transformations.gpu.SwirlFilterTransformation." + VERSION;
|
||||||
private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
|
|
||||||
|
|
||||||
private float radius;
|
private float radius;
|
||||||
private float angle;
|
private float angle;
|
||||||
@ -60,14 +61,17 @@ public class SwirlFilterTransformation extends GPUFilterTransformation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean equals(Object o) {
|
@Override public boolean equals(Object o) {
|
||||||
return o instanceof SwirlFilterTransformation;
|
return o instanceof SwirlFilterTransformation &&
|
||||||
|
((SwirlFilterTransformation) o).radius == radius &&
|
||||||
|
((SwirlFilterTransformation) o).angle == radius &&
|
||||||
|
((SwirlFilterTransformation) o).center.equals(center.x, center.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public int hashCode() {
|
@Override public int hashCode() {
|
||||||
return ID.hashCode();
|
return ID.hashCode() + (int) (radius * 1000) + (int) (angle * 10) + center.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
|
@Override public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
||||||
messageDigest.update(ID_BYTES);
|
messageDigest.update((ID + radius + angle + center.hashCode()).getBytes(CHARSET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,8 @@ package jp.wasabeef.glide.transformations.gpu;
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import jp.co.cyberagent.android.gpuimage.GPUImageToonFilter;
|
import jp.co.cyberagent.android.gpuimage.GPUImageToonFilter;
|
||||||
|
|
||||||
@ -29,7 +31,6 @@ public class ToonFilterTransformation extends GPUFilterTransformation {
|
|||||||
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.gpu.ToonFilterTransformation." + VERSION;
|
"jp.wasabeef.glide.transformations.gpu.ToonFilterTransformation." + VERSION;
|
||||||
private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
|
|
||||||
|
|
||||||
private float threshold;
|
private float threshold;
|
||||||
private float quantizationLevels;
|
private float quantizationLevels;
|
||||||
@ -53,14 +54,16 @@ public class ToonFilterTransformation extends GPUFilterTransformation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean equals(Object o) {
|
@Override public boolean equals(Object o) {
|
||||||
return o instanceof ToonFilterTransformation;
|
return o instanceof ToonFilterTransformation &&
|
||||||
|
((ToonFilterTransformation) o).threshold == threshold &&
|
||||||
|
((ToonFilterTransformation) o).quantizationLevels == quantizationLevels;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public int hashCode() {
|
@Override public int hashCode() {
|
||||||
return ID.hashCode();
|
return ID.hashCode() + (int) (threshold * 1000) + (int) (quantizationLevels * 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
|
@Override public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
||||||
messageDigest.update(ID_BYTES);
|
messageDigest.update((ID + threshold + quantizationLevels).getBytes(CHARSET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,8 @@ package jp.wasabeef.glide.transformations.gpu;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import jp.co.cyberagent.android.gpuimage.GPUImageVignetteFilter;
|
import jp.co.cyberagent.android.gpuimage.GPUImageVignetteFilter;
|
||||||
@ -31,7 +33,6 @@ public class VignetteFilterTransformation extends GPUFilterTransformation {
|
|||||||
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.gpu.VignetteFilterTransformation." + VERSION;
|
"jp.wasabeef.glide.transformations.gpu.VignetteFilterTransformation." + VERSION;
|
||||||
private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
|
|
||||||
|
|
||||||
private PointF center;
|
private PointF center;
|
||||||
private float[] vignetteColor;
|
private float[] vignetteColor;
|
||||||
@ -61,14 +62,19 @@ public class VignetteFilterTransformation extends GPUFilterTransformation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean equals(Object o) {
|
@Override public boolean equals(Object o) {
|
||||||
return o instanceof VignetteFilterTransformation;
|
return o instanceof VignetteFilterTransformation &&
|
||||||
|
((VignetteFilterTransformation) o).center.equals(center.x, center.y) &&
|
||||||
|
Arrays.equals(((VignetteFilterTransformation) o).vignetteColor, vignetteColor) &&
|
||||||
|
((VignetteFilterTransformation) o).vignetteStart == vignetteStart &&
|
||||||
|
((VignetteFilterTransformation) o).vignetteEnd == vignetteEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public int hashCode() {
|
@Override public int hashCode() {
|
||||||
return ID.hashCode();
|
return ID.hashCode() + center.hashCode() + Arrays.hashCode(vignetteColor) +
|
||||||
|
(int) (vignetteStart * 100) + (int) (vignetteEnd * 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
|
@Override public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
||||||
messageDigest.update(ID_BYTES);
|
messageDigest.update((ID + center + Arrays.hashCode(vignetteColor) + vignetteStart + vignetteEnd).getBytes(CHARSET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user