use of org.jwildfire.io.ImageWriter in project JWildfire by thargor6.
the class TinaInteractiveRendererController method saveImageButton_clicked.
public void saveImageButton_clicked() {
try {
pauseRenderThreads();
try {
JFileChooser chooser = new ImageFileChooser(Tools.FILEEXT_PNG);
if (prefs.getOutputImagePath() != null) {
try {
chooser.setCurrentDirectory(new File(prefs.getOutputImagePath()));
} catch (Exception ex) {
ex.printStackTrace();
}
}
if (chooser.showSaveDialog(imageRootPanel) == JFileChooser.APPROVE_OPTION) {
File file = chooser.getSelectedFile();
prefs.setLastOutputImageFile(file);
RenderedFlame res = renderer.finishRenderFlame(displayUpdater.getSampleCount());
new ImageWriter().saveImage(res.getImage(), file.getAbsolutePath());
if (res.getHDRImage() != null) {
new ImageWriter().saveImage(res.getHDRImage(), Tools.makeHDRFilename(file.getAbsolutePath()));
}
if (res.getZBuffer() != null) {
new ImageWriter().saveImage(res.getZBuffer(), Tools.makeZBufferFilename(file.getAbsolutePath()));
}
if (prefs.isTinaSaveFlamesWhenImageIsSaved()) {
new FlameWriter().writeFlame(getCurrFlame(), file.getParentFile().getAbsolutePath() + File.separator + Tools.trimFileExt(file.getName()) + ".flame");
}
if (autoLoadImageCBx.isSelected()) {
parentCtrl.mainController.loadImage(file.getAbsolutePath(), false);
}
}
} finally {
resumeRenderThreads();
}
} catch (Throwable ex) {
errorHandler.handleError(ex);
}
}
Aggregations