【发布时间】:2013-12-20 22:08:24
【问题描述】:
我尝试了两种不同的方法来实现这一点,第一种是 Android 风格的方法,第二种是 OpenGL 风格的方法。从我的活动中,我创建了一个包含 OpenGL (1.1) 代码的视图。
第一种方法(android):
Bitmap b = gameView.GetDrawingCache (true); // this is always null
还有第二种方法(opengl):
public Bitmap GrabScreenshot()
{
int size = Width * Height * 4;
byte[] bytes = new byte[size];
GL.ReadPixels<byte>(0, 0, Width, Height, All.Rgba, All.UnsignedByte, bytes);
Bitmap bmp = BitmapFactory.DecodeByteArray (bytes, 0, size);
return bmp;
}
【问题讨论】: