try {
QTSessionCheck.check();
GDevice gd = GDevice.getMain();
System.out.println ("Got GDevice: " + gd);
PixMap pm = gd.getPixMap();
System.out.println ("Got PixMap: " + pm);
ImageDescription id = new ImageDescription (pm);
System.out.println ("Got ImageDescription: " + id);
QDRect bounds = pm.getBounds();
RawEncodedImage rei = pm.getPixelData();
QDGraphics decompGW = new QDGraphics (id, 0);
QTImage.decompress (rei,
id,
decompGW,
bounds,
0);
GraphicsExporter exporter =
new GraphicsExporter (StdQTConstants4.kQTFileTypePNG);
exporter.setInputPixmap (decompGW);
QTFile outFile = new QTFile (new java.io.File ("screen.png"));
exporter.setOutputFile (outFile);
System.out.println ("Exported " +
exporter.doExport() +
" bytes");
} catch (QTException qte) {
qte.printStackTrace();
}
System.exit(0);