use of org.jwildfire.create.tina.io.FlameWriter in project JWildfire by thargor6.
the class PolylogarithmTest method visual.
@Test
@Ignore
public void visual() throws Exception {
int side = 400;
ResolutionProfile respro = new ResolutionProfile(true, side, side);
int quality = 200;
Flame f = new Flame();
f.setWidth(side);
f.setHeight(side);
f.setGamma(4.0);
f.setBGTransparency(false);
f.setAntialiasAmount(.1);
f.setAntialiasRadius(.1);
Layer l = new Layer();
XForm xf = new XForm();
SquishFunc df = new SquishFunc();
df.setParameter("power", 10);
xf.addVariation(1, df);
PolylogarithmFunc bf = new PolylogarithmFunc();
bf.setParameter("n", 2);
bf.setParameter("zpow", 1);
xf.addVariation(.1, bf);
f.setCamZoom(6);
xf.setWeight(10);
l.getXForms().add(xf);
RGBPalette pal = new RGBPalette();
for (int i = 0; i < 256; i++) pal.addColor(0, i, 255);
pal.setFlam3Name("PolylogarithmFunc");
l.setPalette(pal);
f.setResolutionProfile(respro);
f.getLayers().clear();
f.getLayers().add(l);
f.setPixelsPerUnit(43.75);
new FlameWriter().writeFlame(f, "/dev/shm/PolylogarithmFunc.flame");
JobRenderThreadController controller = new HeadlessBatchRendererController();
List<Job> joblist = new ArrayList<>();
Job j = new Job();
j.setCustomHeight(side);
j.setCustomWidth(side);
j.setCustomQuality(quality);
j.setFlameFilename("/dev/shm/PolylogarithmFunc.flame");
joblist.add(j);
QualityProfile qualpro = new QualityProfile();
qualpro.setQuality(quality);
JobRenderThread job = new JobRenderThread(controller, joblist, respro, qualpro, true);
job.run();
}
use of org.jwildfire.create.tina.io.FlameWriter in project JWildfire by thargor6.
the class MutaGenController method saveFlameBtn_clicked.
public void saveFlameBtn_clicked() {
if (selectedGenerationIdx >= 0 && selectedGenerationIdx < mutationList.size() && selRow >= 0 && selCol >= 0) {
MutationSet selectedSet = mutationList.get(selectedGenerationIdx);
Flame currFlame = selectedSet.getFlame(selRow, selCol);
try {
if (currFlame != null) {
JFileChooser chooser = new FlameFileChooser(prefs);
if (prefs.getOutputFlamePath() != null) {
try {
chooser.setCurrentDirectory(new File(prefs.getOutputFlamePath()));
} catch (Exception ex) {
ex.printStackTrace();
}
}
if (chooser.showSaveDialog(rootPanel) == JFileChooser.APPROVE_OPTION) {
File file = chooser.getSelectedFile();
new FlameWriter().writeFlame(currFlame, file.getAbsolutePath());
currFlame.setLastFilename(file.getName());
prefs.setLastOutputFlameFile(file);
}
}
} catch (Throwable ex) {
errorHandler.handleError(ex);
}
}
}
use of org.jwildfire.create.tina.io.FlameWriter in project JWildfire by thargor6.
the class TinaController method saveFlameButton_actionPerformed.
public void saveFlameButton_actionPerformed(ActionEvent e) {
try {
if (getCurrFlame() != null) {
JFileChooser chooser = new FlameFileChooser(prefs);
if (prefs.getOutputFlamePath() != null) {
try {
chooser.setCurrentDirectory(new File(prefs.getOutputFlamePath()));
} catch (Exception ex) {
ex.printStackTrace();
}
}
if (chooser.showSaveDialog(centerPanel) == JFileChooser.APPROVE_OPTION) {
File file = chooser.getSelectedFile();
String filename = file.getAbsolutePath();
if (!filename.endsWith("." + Tools.FILEEXT_FLAME)) {
filename += "." + Tools.FILEEXT_FLAME;
}
new FlameWriter().writeFlame(generateExportFlame(getCurrFlame()), filename);
getCurrFlame().setLastFilename(file.getName());
messageHelper.showStatusMessage(getCurrFlame(), "flame saved to disc");
prefs.setLastOutputFlameFile(file);
}
}
} catch (Throwable ex) {
errorHandler.handleError(ex);
}
}
use of org.jwildfire.create.tina.io.FlameWriter in project JWildfire by thargor6.
the class TinaController method quicksaveButton_clicked.
public void quicksaveButton_clicked() {
try {
if (getCurrFlame() != null) {
String filename = qsaveFilenameGen.generateNextFilename();
new FlameWriter().writeFlame(generateExportFlame(getCurrFlame()), filename);
messageHelper.showStatusMessage(getCurrFlame(), "quicksave <" + new File(filename).getName() + "> saved");
}
} catch (Throwable ex) {
errorHandler.handleError(ex);
}
}
use of org.jwildfire.create.tina.io.FlameWriter 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