@@ -0,0 +1,2739 @@
+/*%0A * Copyright 2015 Google Inc.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage com.lovejjfg.blogdemo.utils.glide;%0A%0Aimport android.content.Context;%0Aimport android.graphics.Bitmap;%0Aimport android.graphics.BitmapShader;%0Aimport android.graphics.Canvas;%0Aimport android.graphics.Paint;%0Aimport android.graphics.RectF;%0A%0Aimport com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;%0Aimport com.bumptech.glide.load.resource.bitmap.BitmapTransformation;%0A%0A/**%0A * Created by http://stackoverflow.com/a/25806229/409481%0A */%0Apublic class RoundTransform extends BitmapTransformation %7B%0A    private int cornerRadius;%0A    private RectF rectF = new RectF();%0A%0A    public RoundTransform(Context context,int round) %7B%0A        super(context);%0A        this.cornerRadius = round;%0A    %7D%0A%0A    private  Bitmap circleCrop(BitmapPool pool, Bitmap source) %7B%0A        if (source == null) return null;%0A        int width = source.getWidth();%0A        int height = source.getHeight();%0A        rectF.set(0, 0, width, height);%0A%0A//        int size = Math.min(source.getWidth(), source.getHeight());%0A//        int x = (source.getWidth() - size) / 2;%0A//        int y = (source.getHeight() - size) / 2;%0A%0A        // TODO this could be acquired from the pool too%0A        Bitmap squared = Bitmap.createBitmap(source, 0, 0, width, height);%0A%0A        Bitmap result = pool.get(width, height, Bitmap.Config.ARGB_8888);%0A        if (result == null) %7B%0A            result = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);%0A        %7D%0A%0A        Canvas canvas = new Canvas(result);%0A        Paint paint = new Paint(Paint.FILTER_BITMAP_FLAG %7C Paint.DITHER_FLAG %7C Paint%0A                .ANTI_ALIAS_FLAG);%0A        paint.setShader(new BitmapShader(squared, BitmapShader.TileMode.CLAMP, BitmapShader%0A                .TileMode.CLAMP));%0A//        float r = size / 2f;%0A        canvas.drawRoundRect(rectF, cornerRadius, cornerRadius, paint);%0A//        canvas.drawCircle(r, r, r, paint);%0A        return result;%0A    %7D%0A%0A    @Override%0A    protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) %7B%0A        return circleCrop(pool, toTransform);%0A    %7D%0A%0A    @Override%0A    public String getId() %7B%0A        return getClass().getName();%0A    %7D%0A%7D%0A

add RoundTransform.java