Search code examples
androidsurfaceviewcocos2d-android

Surface view as a bitmap in android


I'm using cocos2d.

Now I've added some images in the layer, and played around a bit.

I'm trying to save the whole screen as image file.

How can I do this?


Solution

  • It is my understanding that cocos2d-android also has a CCRenderTexture class with the saveBuffer method. In that case have a look at my CCRenderTexture demo program and blog post for cocos2d-iphone which gives you an example for how to create a screenshot using CCRenderTexture and saveBuffer. The same principle should be applicable to cocos2d-android.