Adding auto-zoom feature to Android-Image-Cropper

In this post I will describe the work I did to add auto-zoom functionality to Android-Image-Cropper library.
The goal is a smooth zoom-in/out experience affected by the size of the cropping window. When the user adjusts the crop window to cover less than 50% of the image current total visible sub-area, auto-zoom-in is triggered to zoom-in and center on the relevant cropping image zoomed sub-area so the crop window will cover 64% of it. Similarly, when the crop rectangle is above 65% auto-zoom-out is triggered so zoomed sub-area will be 51% covered.
 
Steps:

  1. Using matrix scale type for the cropping image in image view .
  2. Handle image rotation via matrix transformation.
  3. Adding auto-zoom-in/out to matrix transformation.
  4. Smoothing transitions using animations.
  5. Cropping using invert matrix transformation.

 

Result:

result.gif
Continue reading

Advertisements