| | |
| | | import android.graphics.Canvas; |
| | | import android.graphics.Paint; |
| | | import android.graphics.RectF; |
| | | import android.support.annotation.NonNull; |
| | | import androidx.annotation.NonNull; |
| | | import android.util.Log; |
| | | |
| | | import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool; |
| | | import com.bumptech.glide.load.resource.bitmap.BitmapTransformation; |
| | |
| | | */ |
| | | public class GlideRoundTransform extends BitmapTransformation { |
| | | private static final String ID = GlideRoundTransform.class.getClass().getName(); |
| | | private static final String TAG = "GlideRoundTransform"; |
| | | private static byte[] ID_BYTES = null; |
| | | private static float radius = 0f; |
| | | private float radius = 0f; |
| | | |
| | | public GlideRoundTransform(Context context) { |
| | | this(context, 12); |
| | |
| | | return roundCrop(pool, bitmap == null ? toTransform : bitmap); |
| | | } |
| | | |
| | | private static Bitmap roundCrop(BitmapPool pool, Bitmap source) { |
| | | private Bitmap roundCrop(BitmapPool pool, Bitmap source) { |
| | | if (source == null) |
| | | return null; |
| | | |
| | | Log.i(TAG, "源图片大小:" + source.getWidth() + "-" + source.getHeight()); |
| | | |
| | | Bitmap result = pool.get(source.getWidth(), source.getHeight(), |
| | | Bitmap.Config.ARGB_8888); |
| | | if (result == null) { |