mirror of
https://github.com/wasabeef/glide-transformations.git
synced 2025-06-08 07:24:05 +08:00
fix Transparency
This commit is contained in:
parent
ffae37274c
commit
4c23e38206
@ -1,5 +1,5 @@
|
||||
VERSION_NAME=1.0.4
|
||||
VERSION_CODE=4
|
||||
VERSION_NAME=1.0.5
|
||||
VERSION_CODE=5
|
||||
GROUP=jp.wasabeef
|
||||
ARTIFACT_ID=glide-transformations
|
||||
|
||||
|
@ -43,20 +43,20 @@ public class CropCircleTransformation implements Transformation<Bitmap> {
|
||||
int width = (source.getWidth() - size) / 2;
|
||||
int height = (source.getHeight() - size) / 2;
|
||||
|
||||
Bitmap.Config config =
|
||||
source.getConfig() != null ? source.getConfig() : Bitmap.Config.ARGB_8888;
|
||||
Bitmap bitmap = mBitmapPool.get(size, size, config);
|
||||
Bitmap bitmap = mBitmapPool.get(size, size, Bitmap.Config.ARGB_8888);
|
||||
if (bitmap == null) {
|
||||
bitmap = Bitmap.createBitmap(size, size, config);
|
||||
bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
|
||||
}
|
||||
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
Paint paint = new Paint();
|
||||
BitmapShader shader = new BitmapShader(source, BitmapShader.TileMode.CLAMP,
|
||||
BitmapShader.TileMode.CLAMP);
|
||||
Matrix matrix = new Matrix();
|
||||
matrix.setTranslate(-width, -height);
|
||||
shader.setLocalMatrix(matrix);
|
||||
if (width != 0 || height != 0) {
|
||||
Matrix matrix = new Matrix();
|
||||
matrix.setTranslate(-width, -height);
|
||||
shader.setLocalMatrix(matrix);
|
||||
}
|
||||
paint.setShader(shader);
|
||||
paint.setAntiAlias(true);
|
||||
|
||||
|
@ -48,11 +48,9 @@ public class RoundedCornersTransformation implements Transformation<Bitmap> {
|
||||
int width = source.getWidth();
|
||||
int height = source.getHeight();
|
||||
|
||||
Bitmap.Config config =
|
||||
source.getConfig() != null ? source.getConfig() : Bitmap.Config.ARGB_8888;
|
||||
Bitmap bitmap = mBitmapPool.get(width, height, config);
|
||||
Bitmap bitmap = mBitmapPool.get(width, height, Bitmap.Config.ARGB_8888);
|
||||
if (bitmap == null) {
|
||||
bitmap = Bitmap.createBitmap(width, height, config);
|
||||
bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
|
||||
}
|
||||
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
|
Loading…
x
Reference in New Issue
Block a user