Search in sources :

Example 21 with FlameWriter

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();
}
Also used : ResolutionProfile(org.jwildfire.base.ResolutionProfile) XForm(org.jwildfire.create.tina.base.XForm) RGBPalette(org.jwildfire.create.tina.palette.RGBPalette) HeadlessBatchRendererController(org.jwildfire.create.tina.batch.HeadlessBatchRendererController) ArrayList(java.util.ArrayList) Layer(org.jwildfire.create.tina.base.Layer) FlameWriter(org.jwildfire.create.tina.io.FlameWriter) JobRenderThread(org.jwildfire.create.tina.batch.JobRenderThread) QualityProfile(org.jwildfire.base.QualityProfile) Job(org.jwildfire.create.tina.batch.Job) JobRenderThreadController(org.jwildfire.create.tina.batch.JobRenderThreadController) Flame(org.jwildfire.create.tina.base.Flame) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 22 with FlameWriter

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);
        }
    }
}
Also used : FlameWriter(org.jwildfire.create.tina.io.FlameWriter) JFileChooser(javax.swing.JFileChooser) FlameFileChooser(org.jwildfire.create.tina.swing.FlameFileChooser) File(java.io.File) Flame(org.jwildfire.create.tina.base.Flame) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame)

Example 23 with FlameWriter

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);
    }
}
Also used : FlameWriter(org.jwildfire.create.tina.io.FlameWriter) JFileChooser(javax.swing.JFileChooser) File(java.io.File)

Example 24 with FlameWriter

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);
    }
}
Also used : FlameWriter(org.jwildfire.create.tina.io.FlameWriter) File(java.io.File)

Example 25 with FlameWriter

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);
    }
}
Also used : FlameWriter(org.jwildfire.create.tina.io.FlameWriter) JFileChooser(javax.swing.JFileChooser) ImageFileChooser(org.jwildfire.swing.ImageFileChooser) ImageWriter(org.jwildfire.io.ImageWriter) File(java.io.File) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame)

Aggregations

FlameWriter (org.jwildfire.create.tina.io.FlameWriter)25 Flame (org.jwildfire.create.tina.base.Flame)15 File (java.io.File)11 RenderedFlame (org.jwildfire.create.tina.render.RenderedFlame)9 JFileChooser (javax.swing.JFileChooser)8 XForm (org.jwildfire.create.tina.base.XForm)6 Clipboard (java.awt.datatransfer.Clipboard)5 StringSelection (java.awt.datatransfer.StringSelection)5 ArrayList (java.util.ArrayList)5 Layer (org.jwildfire.create.tina.base.Layer)5 FACLFlameWriter (org.jwildfire.create.tina.faclrender.FACLFlameWriter)3 ImageWriter (org.jwildfire.io.ImageWriter)3 Test (org.junit.Test)2 QualityProfile (org.jwildfire.base.QualityProfile)2 ResolutionProfile (org.jwildfire.base.ResolutionProfile)2 HeadlessBatchRendererController (org.jwildfire.create.tina.batch.HeadlessBatchRendererController)2 Job (org.jwildfire.create.tina.batch.Job)2 JobRenderThread (org.jwildfire.create.tina.batch.JobRenderThread)2 JobRenderThreadController (org.jwildfire.create.tina.batch.JobRenderThreadController)2 RGBPalette (org.jwildfire.create.tina.palette.RGBPalette)2