I want to implement a crop feature, where I want to have a small rectangle over an imageView. The rectangle should be static and I want to move the image and get the image to be cropped within the rectangular area. Then fetch the image within the rectangle as an cropped image. I have tried creating a canvas using Bitmap as a parameter but it doesn't worked. I have tried a lot to search how to do this. but couldn't find it anywhere. Please help..
Bitmap bitmap=BitmapFactory.decodeResource(this.getResources(), R.drawable.indoor);
Bitmap mutBitmap = Bitmap.createBitmap(200, 400,bitmap.getConfig());
Canvas canvas = new Canvas(mutBitmap);
Paint paint = new Paint();
paint.setColor(Color.BLACK);
paint.setStyle(Paint.Style.FILL_AND_STROKE);
paint.setStrokeWidth(10);
float leftx = 20;
float topy = 20;
float rightx = 50;
float bottomy = 100;
canvas.drawRect(leftx, topy, rightx, bottomy, paint);
I'm using the above code, but no rectangle is drawn on the imageView..