Hi guys.
I am planning to write a "Terminal Service" or "VNC" java program, that is Plataform-independent and efficient. So, I was planning initially to take screenshots of the screen, about 3 a second minimum.
I wrote this code, but each screenshot takes about 300ms to be taken, on a 900MHz Athlon machine, 1024x768x32Bit resolution. I need to reduce this time, is there any efficient way to do that?
My code:
Thanks for any reply!
public class ScreenShotTest {
public ScreenShotTest() {
}
public static void main(String[] args) throws Exception {
final Toolkit toolkit = Toolkit.getDefaultToolkit();
final Dimension screenSize = toolkit.getScreenSize();
final Rectangle screenRect = new Rectangle(screenSize);
// create screen shot
final Robot robot = new Robot();
final BufferedImage image[] = new BufferedImage[10];
for (int i = 0, index = 0; i < 10; i++) {
final long init = System.currentTimeMillis();
image[i] = robot.createScreenCapture(screenRect);
final long time = System.currentTimeMillis() - init;
System.out.println(time);
}
System.out.println("Finished");
}
}