我只在 C# 中使用 DirectX(DirectX for managed Code)(不是 slimdx)
我想获取哪种数据类型是位图的屏幕截图。
所以我想知道如何将表面转换为位图。
但是我找不到任何指南来做到这一点。
感谢您的阅读!
到目前为止,我还附上了我的源代码
PresentParameters present_params = new PresentParameters();
present_params.Windowed = true;
present_params.SwapEffect = SwapEffect.Discard;
d = new Device(0, DeviceType.Hardware, this,
CreateFlags.SoftwareVertexProcessing, present_params);
Stopwatch sw = new Stopwatch();
sw.Start();
Surface s = CaptureScreen();
////////////////////////////
///need to do something/////
///////////////////////////
s.Dispose();
}
public Surface CaptureScreen()
{
Surface s = d.CreateOffscreenPlainSurface(Screen.PrimaryScreen.Bounds.Width,
Screen.PrimaryScreen.Bounds.Height, Format.A8R8G8B8, Pool.Scratch);
d.GetFrontBufferData(0, s);
return s;
}