Re: Make screenshot of work display.
Posted by Pixelapp on Sep 13, 2012; 12:34am
URL: https://forum.jogamp.org/Make-screenshot-of-work-display-tp4026085p4026147.html
Ok Andriy, here is the code:
try
{
BufferedImage tScreenshot = Screenshot.readToBufferedImage(0,0, 600, 600, false);
File tScreenCaptureImageFile = new File("src/yourpa/ckage/hello.png");
ImageIO.write(tScreenshot, "png", tScreenCaptureImageFile);
}
catch (IOException ioe)
{
System.out.println (ioe.getMessage ());
}
To avoid the error you get, I suggest you put this code at the end of the display() method. And since you will be using the animator, lower the frame rate to 1 frame per second otherwise it will crash during this test.
Moreover, judging by the fact that this class was developed by Jogampers I expect it to be of high quality and a really fast class. Therefore I'm sticking to this class to develop my project much further.