从DirectX游戏截取屏幕截图 [英] Taking screenshots from DirectX games

查看:108
本文介绍了从DirectX游戏截取屏幕截图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我需要捕捉DirectX游戏的截图。我正在使用此代码,但有时我会得到完全空白的图像或桌面图像(但游戏已打开)


int screenWidth = Screen.GetBounds(new Point(0,0) ))。宽度;

int screenHeight = Screen.GetBounds(新点(0,0))。高度;

位图bmpScreenShot =新位图(screenWidth,screenHeight);

图形gfx = Graphics.FromImage((图像)bmpScreenShot);

gfx.CopyFromScreen(0,0,0,0,new Size(screenWidth,screenHeight));

bmpScreenShot.Save(" test.jpg",ImageFormat.Jpeg);


在XP上实际上没有问题,有时在Vista上我得到空白屏幕和Windows 7我一直看到桌面视图,但游戏是在前台。我在Windows 7的左上角看到游戏是一个小黑盒子。



我真的需要帮助。


谢谢。

Hi
I need to capture screenshots from DirectX games. I am using this code but sometimes I get totally blank images or the image of the desktop (but the game is open)

int screenWidth = Screen.GetBounds(new Point(0, 0)).Width;
int screenHeight = Screen.GetBounds(new Point(0, 0)).Height;
Bitmap bmpScreenShot = new Bitmap(screenWidth, screenHeight);
Graphics gfx = Graphics.FromImage((Image)bmpScreenShot);
gfx.CopyFromScreen(0, 0, 0, 0, new Size(screenWidth, screenHeight));
bmpScreenShot.Save("test.jpg", ImageFormat.Jpeg);

There is actually no problem on XP, sometimes on Vista I get blank screen and on Windows 7 I get the view of desktop all the time but the game is on foreground. I see the game as a little black box at upper left corner on Windows 7.



I really need help.

Thanks.

推荐答案

你只需要屏幕截图吗?

或者你需要自己拍摄屏幕截图申请?

使用像SnagIt这样的东西可能更容易。这可以拍摄DirectX应用程序 - 而不是重新发明轮子
Do you just need screen shots?
Or do you need to take screen shots from within your own application?
It may just be easier to use something like "SnagIt" which can take shots of DirectX applications - than to re-invent the wheel


@tlhintoq


我需要申请从DirectX应用程序截取屏幕截图。
@tlhintoq
I need my application to take screenshots from DirectX applications.



在XP上实际上没有问题,有时在Vista上我得到空白屏幕,在Windows 7上我得到桌面视图一直是游戏,但游戏是在前台。
There is actually no problem on XP, sometimes on Vista I get blank screen and on Windows 7 I get the view of desktop all the time but the game is on foreground.



您需要深入研究DirectX的实际工作方式。它不会吸引屏幕内存。这就是你捕获桌面的原因,因为桌面就是Windows和内存空间。


DirectX利用显卡内存和硬件加速。


简而言之,您需要先了解DirectX才能捕获它。

You need to dig into how DirectX actually works. It doesn''t draw to the screen memory. That''s why you are capturing the desktop, because the desktop is what is in Windows and in that memory space.

DirectX makes use of the video card memory and hardware acceleration.

In short, you need to learn about DirectX before you are going to be able to capture it.


这篇关于从DirectX游戏截取屏幕截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆