Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/307.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 大于2048x2048的Xna屏幕截图(reach剖面)_C#_Bitmap_Xna_Rendering - Fatal编程技术网

C# 大于2048x2048的Xna屏幕截图(reach剖面)

C# 大于2048x2048的Xna屏幕截图(reach剖面),c#,bitmap,xna,rendering,C#,Bitmap,Xna,Rendering,需要知道如何保存整个图形设备backbuffer的屏幕截图。 使用“到达轮廓”(Reach profile)将纹理限制为2048x2048 *加载位图或从内存流加载似乎并不受此限制 void ScreenshotFull() { Microsoft.Xna.Framework.Color[] screenData = new Microsoft.Xna.Framework.Color[graphics.GraphicsDevice.PresentationParamete

需要知道如何保存整个图形设备backbuffer的屏幕截图。 使用“到达轮廓”(Reach profile)将纹理限制为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以矩形或区域为目标吗?

鉴于这是一个配置文件限制(我猜你不能升级到HiDef),你不能只提取三分之一的后缓冲区,三次吗?如果配置文件只允许2048x2048,那么backbuffer可以包含如此大的图像,我觉得很奇怪,但除非我的建议在技术上可行。然后使用System.Drawing位图API或类似的东西将它们合并在一起?这实际上就是我要做的。使用相机矩阵作为spritebatch.draw重载。拍摄2048x2048缓冲区的照片,然后将相机移动到2048 x上,再拍摄另一张照片等,然后缝合在一起。不完全理想,因为能够从缓冲区中拉出一个矩形会更好。