My intention is to have the user pick an image from the gallery, then have a cropping activity come up. However, I need the rectangle that defines the cropping mask to be locked
You need to create a custom ImageView
class to achieve zooming and panning of an image and can have a fixed rectangle image(transparent)
overlaying on this image. And can create sub-bitmap of that bitmap. and save it in a file.
createBitmap(Bitmap source, int x, int y, int width, int height);
This method is used to create a sub-bitmap.
http://blog.sephiroth.it/2011/04/04/imageview-zoom-and-scroll/
After achieving zooming and panning, I am not sure if createBitmap
can create sub-bitmap from the visible portion of the image(i.e. part of image wont be visible on the screen when it is zoomed), So try getting the drawingCache()
from imageView
and create sub-bitmap for the same.