Java 小程序的屏幕截图
我想“捕获”Java 小程序当前加载后的样子的屏幕截图,从而在不使用 vdu 的情况下有效地对小程序进行屏幕截图。
这样做的目的是向没有 JVM 的用户显示图像。假设该小程序是一个数字时钟,并且不需要用户输入。因此,可以做的就是设置一台连接到 vdu 的电脑,打开小程序,安排一个脚本来截取屏幕截图并上传图像。然后,客户端可以在任何给定时间访问小程序的外观,而不需要 jvm。
让一台电脑一直运行等等会很麻烦。当然这可以在没有显示器的情况下以某种方式完成。
是否可以在 jvm 中创建一个虚拟显示器,可以渲染小程序,然后进行屏幕捕获?
如果这是可能的,那么也许可以虚拟化真正的高分辨率显示器来创建非常高分辨率的屏幕截图。
I'd like to "capture" a screenshot of what a java applet would currently look like if it were loaded, effectively screenshoting an applet without the use of a vdu.
The purpose of this is to display the image to a user that doesn't have a JVM. Lets assume the applet is a digital clock and has no requirement on user input. So what could be done is set up a pc connected to a vdu, open the applet, schedule a script to take a screenshot and upload the image. Clients could then access what the applet would look like at any given time without the requirement on a jvm.
It'd be such a hassle to have a pc running all the time etc. Surely this could be done somehow without a display.
Would it be possible to create a virtual display in a jvm that can render an applet and then take a screen capture?
If this were possible then perhaps a really high resolution display could be virtualized to create a very high resolution screenshot.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
ScreenImage 类应该处理这个问题。
The ScreenImage class should handle this.
看看java.awt.Robot#createScreenCapture(java.awt.Rectangle)
Look at java.awt.Robot#createScreenCapture(java.awt.Rectangle)
如果这行得通,我想知道,提醒沙箱,正如上面的链接所述“无论您有 AWT 还是 Swing 应用程序,这都将起作用。”
If this would work, i would wonder, remind the sandbox, and as the above link stated "This will work whether you have an AWT or Swing application."
如果您在小程序中使用“渲染引擎”(在 repaint()'ing 之前将每个像素组合为可绘制的内容),则可以使用此信息并创建图像。
If you use a "rendering-engine" (composing each pixel to something paintable before repaint()'ing) within you applet, you could use this information and create an image.