jayrambhia / CropperNoCropper

Instagram Style Image Cropper for Android (Library)
http://www.jayrambhia.com/project/nocropper-library
Apache License 2.0
474 stars 99 forks source link

save translations done on the image and restore back #42

Closed BawenderTft closed 5 years ago

BawenderTft commented 5 years ago

Hi , Thanks for the awesome work on the library. I wish to use the same thing just like instagram does for multi image cropping, my use case is

  1. The user will be shown a list of images from gallery anf the cropperview just like instagram .
  2. I want the user to select the image and do his opertations like scaling postioning in the cropperview
  3. when the user clicks on another image we save the translations and scaling done on the image and restore back when the user clicks on the same image again.

please suggest if this thing is possible. I am short on time as well here , so would appriciate a quick response.

jayrambhia commented 5 years ago

Thanks for raising this issue. I am working on a solution and should be available today.

jayrambhia commented 5 years ago

Support will be available from 0.3.1 version.

jayrambhia commented 5 years ago

Use getCropMatrix() to obtain CropMatrix and use setCropMatrix(CropMatrix matrix) to restore the state.

BawenderTft commented 5 years ago

Hi, I am having a problem with the image cropmatrix. The method setCropMatrix(cropmatrix, animate); works only if you set the animate method to be true and not if set to false, I wish to user this without the animation. Can please help.

jayrambhia commented 5 years ago

Hi @BawenderTft, Can you share the snippet of your code where you are calling this method?

jayrambhia commented 5 years ago

Hi @BawenderTft, Just double checked and it does seem to work. Please check the sample: https://github.com/jayrambhia/CropperNoCropper/blob/master/sample/src/main/java/com/fenctose/imagecropper/MainActivity.java#L171

Currently, we need to call setCropMatrix method after some delay.

mImageView.setImageBitmap(mBitmap);
new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
                    mImageView.setCropMatrix(matrix, false);
                }
            }, 30);