我尝试流式传输我的桌面,问题是我使用 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));
夏普DX
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));
而且...我需要在位图中备份表面。预先感谢 !