mirror of
https://github.com/wasabeef/glide-transformations.git
synced 2025-06-30 13:24:34 +08:00
fix bugs issue #35
This commit is contained in:
parent
592815a6a0
commit
f9bca8887d
@ -88,7 +88,7 @@ public class BlurTransformation implements Transformation<Bitmap> {
|
|||||||
paint.setFlags(Paint.FILTER_BITMAP_FLAG);
|
paint.setFlags(Paint.FILTER_BITMAP_FLAG);
|
||||||
canvas.drawBitmap(source, 0, 0, paint);
|
canvas.drawBitmap(source, 0, 0, paint);
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
||||||
try {
|
try {
|
||||||
bitmap = RSBlur.blur(mContext, bitmap, mRadius);
|
bitmap = RSBlur.blur(mContext, bitmap, mRadius);
|
||||||
} catch (RSRuntimeException e) {
|
} catch (RSRuntimeException e) {
|
||||||
|
@ -28,11 +28,12 @@ import android.renderscript.ScriptIntrinsicBlur;
|
|||||||
|
|
||||||
public class RSBlur {
|
public class RSBlur {
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
|
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
|
||||||
public static Bitmap blur(Context context, Bitmap bitmap, int radius) throws RSRuntimeException {
|
public static Bitmap blur(Context context, Bitmap bitmap, int radius) throws RSRuntimeException {
|
||||||
RenderScript rs = null;
|
RenderScript rs = null;
|
||||||
try {
|
try {
|
||||||
rs = RenderScript.create(context);
|
rs = RenderScript.create(context);
|
||||||
|
rs.setMessageHandler(new RenderScript.RSMessageHandler());
|
||||||
Allocation input =
|
Allocation input =
|
||||||
Allocation.createFromBitmap(rs, bitmap, Allocation.MipmapControl.MIPMAP_NONE,
|
Allocation.createFromBitmap(rs, bitmap, Allocation.MipmapControl.MIPMAP_NONE,
|
||||||
Allocation.USAGE_SCRIPT);
|
Allocation.USAGE_SCRIPT);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user