rosenlu / sylon

2 stars 0 forks source link

Implement visual Cropper Activity #12

Open strassan opened 3 years ago

strassan commented 3 years ago

This activity should start after the user has taken an image (or chosen one from the gallery).

In this first step, the cropping should only show visual cues, i.e. four point which can be dragged and dropped freely. The points should also be connected to each other to indicate the edges of a page.

The second step would be to do the actual perspective transform, see issue #1.

rosenlu commented 3 years ago

Imagine a photo where a square page is laid out rotated by 45 degrees. How does the app know which side should end up as the top side in a pdf? This also ties into an issue I have with Google Drive scans where my phone is held flat and the scanner believes it needs to rotate the cropped image by 90 degrees because my phone was in landscape mode.

My proposal is to have a subtle UI element to specify the top edge of the paper. If all 4 points are connected by lines, the user can tap a line which then changes appearance (this side up? triangle? arrow?). This way the perspective transform knows exactly which corners the user wants as top left/top right and so on.

rosenlu commented 3 years ago

Page ID should not be the Intent extra data to start the Activity with, at least not the only one. A photo does not have an ID until the PageListActivity is Paused. If the fragments start the Cropper with an Intent, it should be the URI of the image. For the same reason, the Cropper cannot interact with the database (which would be sensible encapsulation as well). Then the Cropper result is the 4 points selected, which may have to be packed into a String (the numbers could be integers if the unit is pixels on the bitmap). Adding the crop as part of the camera/gallery fragments flow can be low-prio, but having the Intent and Result laid out with that in mind would be smart.

For the use case present right now (update crop from Page list), integration is trivial. The 4-point result needs to be updated in the database inside PageListActivity.