1

我想将surfaceview复制到位图,但只是得到黑色(ff000000)

    //this.surView is my SurfaceView 
    Bitmap bitmap =Bitmap.createBitmap(this.surView.getWidth(), this.surView.getHeight(),      Bitmap.Config.RGB_565); 
      //this.can is my canvas
    this.can = this.surHolder.lockCanvas(new  Rect(0,0,this.surView.getWidth(), this.surView.getHeight()));
     this.can.setBitmap(bitmap);
     this.surView.draw(this.can);
     this.surHolder.unlockCanvasAndPost(can);
       // bitmap = Bitmap.createBitmap(bitmap);
                  //copy bitmap from (srcx,srcy) to (x,y) 
        bitmap = Bitmap.createBitmap(bitmap, srcx, srcy, cx, cy);

        this.ondrawImage(bitmap, x, y);
4

1 回答 1

-2

使用 surfaceview.getDrawingCache()会得到Bitmap。

于 2012-12-01T04:57:50.557 回答