2

I am working on an Image Cropper. User pass a bitmap and could use an oval to clip the bitmap.

My Code:

public class CropView extends View{

    @Override
    protected void onDraw(Canvas canvas) {
           //Draw user's image to canvas
           canvas.drawBitmap(mBitmap, mMatrix, mPaint1);

           //Draw an oval shape.Contents inclued this shape should be clip and then save.
           //Please ignore method generateOvalPath(), it just generate a resizeable oval
           Path ovalPath = generateOvalPath();
           canvas.drawPath(ovalPath,mPaint2);

           **//How to save the contents included within the oval to a Bitmap?**
    }

}

enter image description here

4

0 回答 0