wasabeef / Blurry

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

Reverse mode #41

Open edsilfer opened 7 years ago

edsilfer commented 7 years ago

Is it possible to use this library in reverse mode? From blur to high definition?

piterwilson commented 7 years ago

+1 for this. This library is nice but this is incomplete functionality. Like most Android.

In any case, i did manage to implement my own reverse. The way to do it is to use the .into() functionality and blur into an ImageView and then you can animated the alpha of that ImageView

edsilfer commented 7 years ago

@piterwilson I've done the same here

Mrtopy commented 7 years ago

Hi, I'm trying to achieve the same. Can you be more specific, please?

Thanks.

Mrtopy commented 7 years ago

Managed to achieve what I wanted back then. For the others:

int unblurSeconds = 10;

runnableCode = new Runnable() {
            @Override
            public void run() {
                // Do something here on the main thread
                unblurSeconds--;

                if(unblurSeconds == 0) {
                    bmImage.setImageBitmap(result);
                    return;
                }
                Blurry.with(context)
                        .radius(unblurSeconds)
                        .sampling(1)
                        .async()
                        .from(result)
                        .into(bmImage);

                // Repeat this the same runnable code block again another 1 seconds
                handler.postDelayed(runnableCode, 1000);
            }
        };

        // Start the initial runnable task by posting through the handler
        handler.post(runnableCode);