1
0
mirror of https://github.com/wasabeef/glide-transformations.git synced 2025-06-29 04:44:47 +08:00
This commit is contained in:
wasabeef 2015-01-12 00:20:24 +09:00
parent 53a1f6bd0f
commit 5bb10cc0c7
3 changed files with 7 additions and 7 deletions

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();