Xna屏幕截图大于2048x2048(到达个人资料)

时间:2015-12-11 22:23:51

标签: c# bitmap xna rendering

需要知道如何保存整个graphicsdevice backbuffer的屏幕截图。 使用Reach配置文件将纹理限制为2048x2048。

*加载位图或从内存流中加载似乎并不受此限制。

void ScreenshotFull()
    {
        Microsoft.Xna.Framework.Color[] screenData = new Microsoft.Xna.Framework.Color[graphics.GraphicsDevice.PresentationParameters.BackBufferWidth *
                                       graphics.GraphicsDevice.PresentationParameters.BackBufferHeight];

        RenderTarget2D screenShot = new RenderTarget2D(graphics.GraphicsDevice,2048, 2048);

        graphics.GraphicsDevice.SetRenderTarget(screenShot);
        Draw(new GameTime());
        graphics.GraphicsDevice.SetRenderTarget(null);
        using (FileStream stream = new FileStream(Environment.CurrentDirectory + @"\Content\map\Full" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".png", FileMode.Create))
        {
            screenShot.SaveAsPng(stream, screenShot.Width, screenShot.Height);
            screenShot.Dispose();
        }

    }

理想的截图是5632x2048。我可以使用第二个RenderTarget定位矩形或区域吗?

0 个答案:

没有答案