问题
I need to crop an Image in irregular shape my app, i.e., I select a portion by finger and if I click crop button, the selected portion alone in the Image will be saved in SDCard.
How to achieve it?
回答1:
You have to define a Path for the Shape you want to be cut out.
Then create a rectangle around it an set everything between your shape an the rectangle to transparent (Alpha Channel)
This source here should give you some hints:
https://github.com/lvillani/android-cropimage/blob/develop/src/com/android/camera/CropImage.java
Take a look at the onSaveClicked method, line 209
回答2:
Refer this project: https://github.com/coderush/FlexiCrop
It has the code to crop irregular shapes.
来源:https://stackoverflow.com/questions/13671456/crop-an-image-in-irregular-shape