wasabeef / Blurry

Blurry is an easy blur library for Android
Apache License 2.0
5.57k stars 602 forks source link

Imageview larger than screen size #42

Open hablema opened 7 years ago

hablema commented 7 years ago

Hi,

This is an excellent library and very much thankful for the same. I have been using this library for some time now and i have noticed that when the imageview is larger than the screen, it dosen't generate a blurred output. I'm using a simple code

Blurry.with(getContext()).radius(10).sampling(8).async().capture(imageView).into(imageView);

My imageView is larger than the view area in the screen and i have kept it like that. No error is shown, but the imageView becomes blank. I also had problem getting the drawing cache for the view. What i did was

`public Bitmap loadBitmapFromView(View v) {

    int width = v.getLayoutParams().width;
    int height = v.getLayoutParams().height;
    Bitmap b = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
    Canvas c = new Canvas(b);
    v.layout((int) ((float) screenWidth * -0.2f), 0, width, height);
    v.draw(c);
    return b;

}`

This solved my drawingcache problem. So what has gone wrong with the blur. What should i do to get the blurred output.

cbedoy commented 7 years ago

Remember that you'll working with a lot of devices with different specs, you should do downscaling maybe you have a good device, downscaling's a good pattern even the library doesn't support, just an advice.