如何根据Path将Canvas保存到位图

时间:2013-04-03 06:04:58

标签: android canvas

我正在研究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?**
    }

}

enter image description here

0 个答案:

没有答案