Android: creating a Bitmap with SurfaceView content

draw your SurfaceView onto a Canvas that's backed by a Bitmap?

    // be sure to call the createBitmap that returns a mutable Bitmap
    Bitmap b = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888); 
    Canvas c = new Canvas(b);
    yourSurfaceView.draw(c);
 it's not possible with SurfaceViews because the drawing process is done in a thread and the canvas is obtained from the SurfaceHolder. It is used this way: canvas = surfaceHolder.lockCanvas(null); synchronized(surfaceHolder) { doDraw(canvas); }
发布了6 篇原创文章 · 获赞 44 · 访问量 11万+

猜你喜欢

转载自blog.csdn.net/sinat_29255093/article/details/79932077