开发者

java: creating image of your program

I am trying to create an image of one of my JPanels at a fixed resolution, or at a resolution that may be bigger than the current screen resolution. Consequently I cannot use a simple screen capture method as it causes my image resolution to be dependent on the resolution of the screen, which the user sets. Is there a way around this?

Alternatively, is there a way to do this in openGL? Create a virtual buffer, render into it, then 开发者_Python百科create an image based on that virtual space?


Just create the control, you don't need to add it to any JFrame or otherwise cause it to be displayed. You can subsequently use the print method on it to cause it to be rendered to a Graphics object. You can set the size and such as you like without having to take care of the screen boundaries (as the control is never displayed on screen).


Look at JxCapture. It's a commersial product but you can get free license if you're developing open-source (or maybe even non-commercial) project.


Check out the Screen Image class.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜