i m trying to implement freehand crop in android using canvas. i use drawPath
and store it in List and draw it in canvas path drawing ok,
like this
Lets look at a bit more complex example:
The red point is the point you want to test. You have to find the edges that cross the y coordinate of the red point. In this example 4 edges cross the y coordinate (the blue points).
Now test how much intersections you get on the left side and on the right side of the point you want to check. If there is an odd number of intersections on both sides the point is inside the shape.
update: you can find a more detailed description of this algorithm here
Hi i think below link for your exact solution, what u try?
Android: Free Croping of Image
Don't forget to put your vote and feedback here.
You can use Canvas.clipPath to draw only cropped region. But be awared that this method doesn't work with hardware acceleration so you have to turn it off and use software rendering.