1
0
mirror of https://github.com/wasabeef/glide-transformations.git synced 2025-06-09 07:54:04 +08:00

Refactor: Comments

This commit is contained in:
wasabeef 2015-01-20 23:36:25 +09:00
parent 5775d8211c
commit d474911010
2 changed files with 1 additions and 4 deletions

View File

@ -58,7 +58,7 @@ Glide.with(this).load(R.drawable.demo).bitmapTransform(
## Step 4 ## Step 4
If you are using BlurTransformation. If you are using `BlurTransformation`.
```groovy ```groovy
android { android {

View File

@ -53,14 +53,11 @@ public class BlurTransformation implements Transformation<Bitmap> {
Bitmap source = resource.get(); Bitmap source = resource.get();
if (Build.VERSION.SDK_INT > 16) { if (Build.VERSION.SDK_INT > 16) {
//recreate new bitmap based on source bitmap
Bitmap outBitmap = Bitmap.createBitmap(source.getWidth(), source.getHeight(), Bitmap outBitmap = Bitmap.createBitmap(source.getWidth(), source.getHeight(),
Bitmap.Config.ARGB_8888); Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(outBitmap); Canvas canvas = new Canvas(outBitmap);
canvas.drawBitmap(source, 0, 0, null); canvas.drawBitmap(source, 0, 0, null);
//apply blur effect on image
RenderScript rs = RenderScript.create(mContext); RenderScript rs = RenderScript.create(mContext);
Allocation overlayAlloc = Allocation.createFromBitmap(rs, outBitmap); Allocation overlayAlloc = Allocation.createFromBitmap(rs, outBitmap);
ScriptIntrinsicBlur blur = ScriptIntrinsicBlur.create(rs, overlayAlloc.getElement()); ScriptIntrinsicBlur blur = ScriptIntrinsicBlur.create(rs, overlayAlloc.getElement());