mirror of
https://github.com/wasabeef/glide-transformations.git
synced 2025-06-29 04:44:47 +08:00
refactor
This commit is contained in:
parent
53a1f6bd0f
commit
5bb10cc0c7
@ -39,10 +39,10 @@ public class CropCircleTransformation implements Transformation<Bitmap> {
|
||||
Bitmap source = resource.get();
|
||||
int size = Math.min(source.getWidth(), source.getHeight());
|
||||
|
||||
int x = (source.getWidth() - size) / 2;
|
||||
int y = (source.getHeight() - size) / 2;
|
||||
int width = (source.getWidth() - size) / 2;
|
||||
int height = (source.getHeight() - size) / 2;
|
||||
|
||||
Bitmap squaredBitmap = Bitmap.createBitmap(source, x, y, size, size);
|
||||
Bitmap squaredBitmap = Bitmap.createBitmap(source, width, height, size, size);
|
||||
if (squaredBitmap != source) {
|
||||
source.recycle();
|
||||
}
|
||||
|
@ -44,10 +44,10 @@ public class CropSquareTransformation implements Transformation<Bitmap> {
|
||||
Bitmap source = resource.get();
|
||||
int size = Math.min(source.getWidth(), source.getHeight());
|
||||
|
||||
int x = (source.getWidth() - size) / 2;
|
||||
int y = (source.getHeight() - size) / 2;
|
||||
int width = (source.getWidth() - size) / 2;
|
||||
int height = (source.getHeight() - size) / 2;
|
||||
|
||||
Bitmap bitmap = Bitmap.createBitmap(source, x, y, size, size);
|
||||
Bitmap bitmap = Bitmap.createBitmap(source, width, height, size, size);
|
||||
if (bitmap != source) {
|
||||
source.recycle();
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public class GrayscaleTransformation implements Transformation<Bitmap> {
|
||||
int width = source.getWidth();
|
||||
int height = source.getHeight();
|
||||
|
||||
Bitmap bitmap = Bitmap.createBitmap(outWidth, outHeight, Bitmap.Config.ARGB_8888);
|
||||
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
|
||||
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
ColorMatrix saturation = new ColorMatrix();
|
||||
|
Loading…
x
Reference in New Issue
Block a user