use of org.jwildfire.io.SunFlowWriter in project JWildfire by thargor6.
the class MainController method saveImage.
public void saveImage() throws Exception {
Buffer buffer = getActiveBuffer();
if (buffer != null) {
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(windowMenu) == JFileChooser.APPROVE_OPTION) {
File file = chooser.getSelectedFile();
prefs.setLastOutputImageFile(file);
if (buffer.getBufferType() == BufferType.IMAGE) {
new ImageWriter().saveImage(buffer.getImage(), file.getAbsolutePath());
} else if (buffer.getBufferType() == BufferType.HDR_IMAGE) {
new ImageWriter().saveImage(buffer.getHDRImage(), file.getAbsolutePath());
} else if (buffer.getBufferType() == BufferType.MESH3D) {
new SunFlowWriter().saveMesh(buffer.getMesh3D(), file.getAbsolutePath());
} else {
showMessage("Not supported");
return;
}
}
}
}
Aggregations