mono/MonoGame — pull request #2382 by danzel (2014-04-20 00:27:20+00:00)
Title: Add GraphicsDevice.GetBackBufferData and implementations for GL/DirectX

This allows taking screenshots of your running game!

At the moment the implementation only supports byte[] data and returns the data as RGBA/BGRA 32bit, it could be extended to support more formats.
The format of the pixels differs by platform. XNA and WindowsGL return it in BGRA, WindowsDX, iOS, Android returns it in RGBA.

It should be possible to get WindowsDX to return data in the same format, but this was my first time doing DirectX programming :) (Doing a cpu side swap just so user code can undo it seems wrong)
Android and iOS image code handles RGBA data, so they aren't really an issue.

Only the simplest version of this function is implemented, there are two others which have not been included:
http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.graphics.graphicsdevice.getbackbufferdata.aspx

Tested on iOS, Android, Windows(GL/DX).

I have an example for WindowsDX, WindowsGL, iOS and Android using this here:
https://github.com/danzel/WrapTest/blob/master/WrapTest/WrapTest/Game1.cs#L199-L250
It might be nice to have this example code somewhere, any suggestions?

Fixes #1885