Android bitmap surface representation

I am using cocos2d.

Now I added some images to the layer and played a little.

I am trying to save the whole screen as an image file.

How can i do this?

+4
source share
2 answers

I understand that cocos2d-android also has a CCRenderTexture class with saveBuffer method. In this case, check out my CCRenderTexture demo and the blog post for cocos2d-iphone, where you can give an example of creating a screenshot using CCRenderTexture and saveBuffer. The same principle should apply to cocos2d android.

+1
source

The only way to capture SurfaceView content is to render in it using OpenGL. You can use glReadPixels () to capture the contents of a surface. If you draw a SurfaceView using Canvas, you can simply create a bitmap, create a new canvas for that bitmap, and execute your drawing code with a new Canvas.

+2
source

Source: https://habr.com/ru/post/1385835/


All Articles