使用Java的DirectX程序的屏幕截图
问题描述:
我编写了一个Java应用程序,该应用程序使用java.awt.Robot来捕获屏幕的屏幕截图,并且想知道是否可以使用DirectX/OpenGL捕获程序吗?
I wrote a Java application that uses the java.awt.Robot to take screen captures of the screen and was wondering if capturing a program using DirectX/OpenGL would be possible?
每次尝试执行此操作时,都会出现黑屏
Each time I try to do this, I get a black screen
答
是可以的.但也许仅在有限的情况下.
Yes it is possible. But maybe only in limited circiumstances.
我已经使用机器人一些关于实施的特定信息可能与您有所不同:
Some specific information about the implementation that may be different for you:
- 对createScreenCapture的调用是在OpenGL中完成的 应用.
- 该应用程序使用了重量级的GLCanvas
- 它使用了Java 6
- The call to createScreenCapture was done from within the OpenGL application.
- The application used heavyweight GLCanvas
- It used Java 6
确保将正确的坐标传递给它.您可以从 GraphicsEnvironment 获取屏幕坐标. a>
Make sure you pass it the correct coordinates. You can get the screen coordinates to use from the GraphicsEnvironment