| | |
| | | private static final String ID = GlideRoundTransform.class.getClass().getName(); |
| | | private static final String TAG = "GlideRoundTransform"; |
| | | private static byte[] ID_BYTES = null; |
| | | private float radius = 0f; |
| | | private float radius = 0f; |
| | | |
| | | public GlideRoundTransform(Context context) { |
| | | this(context, 12); |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | public GlideRoundTransform(Context context, int dp) { |
| | | this.radius = Resources.getSystem().getDisplayMetrics().density * dp; |
| | |
| | | return roundCrop(pool, bitmap == null ? toTransform : bitmap); |
| | | } |
| | | |
| | | private Bitmap roundCrop(BitmapPool pool, Bitmap source) { |
| | | private Bitmap roundCrop(BitmapPool pool, Bitmap source) { |
| | | if (source == null) |
| | | return null; |
| | | |
| | |
| | | BitmapShader.TileMode.CLAMP)); |
| | | paint.setAntiAlias(true); |
| | | RectF rectF = new RectF(0f, 0f, source.getWidth(), source.getHeight()); |
| | | |
| | | canvas.drawRoundRect(rectF, radius, radius, paint); |
| | | |
| | | return result; |
| | | } |
| | | |