/** * Called by postFrame() once the screen has been captured to outBuf. */ protected void writeImageFile( File file ) throws IOException { OutputStream outStream = new FileOutputStream(file); try { JmeSystem.writeImageFile(outStream, "png", outBuf, width, height); } finally { outStream.close(); } } }
/** * Called by postFrame() once the screen has been captured to outBuf. */ protected void writeImageFile( File file ) throws IOException { OutputStream outStream = new FileOutputStream(file); try { JmeSystem.writeImageFile(outStream, "png", outBuf, width, height); } finally { outStream.close(); } } }
public void saveScreenshot() { File file = new File(getFilePath() + getFileName() + ".png").getAbsoluteFile(); logger.log(Level.INFO, "Saving ScreenShot to: {0}", file.getAbsolutePath()); OutputStream outStream = null; try { outStream = new FileOutputStream(file); JmeSystem.writeImageFile(outStream, "png", outBuf, width, height); } catch (IOException ex) { logger.log(Level.SEVERE, "Error while saving screenshot", ex); } finally { if (outStream != null) { try { outStream.close(); } catch (IOException ex) { logger.log(Level.SEVERE, "Error while saving screenshot", ex); } } } }