视频捕捉/截图

时间:2013-01-07 17:18:28

标签: c# slimdx

我尝试流式传输我的桌面,问题是我使用GDI时有8/10 fps,使用SlimDX时有1 fps。

GDI

Bitmap bmp = new Bitmap(1680,1050);

Graphics g = Graphics.FromImage(bmp);

g.CopyFromScreen(0, 0,0, 0, new System.Drawing.Size(1680,1050));

SharpDX

PresentParameters present_params = new PresentParameters();
present_params.Windowed = true;
present_params.SwapEffect = SwapEffect.Discard;
present_params.BackBufferCount = 1;
present_params.FullScreenRefreshRateInHertz = 0;
Device d = new Device(new Direct3D(), 0, DeviceType.Hardware, IntPtr.Zero, CreateFlags.SoftwareVertexProcessing, present_params);

Surface s = Surface.CreateOffscreenPlain(d, 1680, 1050, Format.A8R8G8B8, Pool.Scratch);

d.GetFrontBufferData(0, s);

bmp = new Bitmap(SlimDX.Direct3D9.Surface.ToStream(s, SlimDX.Direct3D9.ImageFileFormat.Bmp));

而且......我需要在Bitmap中备份表面。 提前谢谢!

0 个答案:

没有答案