我正在研究Image Cropper。用户传递位图并可以使用椭圆来剪切位图。
我的代码:
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?**
}
}