Search in sources :

Example 11 with FlameWriter

use of org.jwildfire.create.tina.io.FlameWriter in project JWildfire by thargor6.

the class TinaController method allsaveButton_clicked.

public void allsaveButton_clicked() {
    try {
        List<Flame> flames = new ArrayList<>();
        for (FlameThumbnail thumbnail : randomBatch) {
            if (thumbnail.getSelectCheckbox() != null && thumbnail.getSelectCheckbox().isSelected()) {
                flames.add(generateExportFlame(thumbnail.getFlame()));
            }
        }
        if (!flames.isEmpty()) {
            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().writeFlames(flames, filename);
                messageHelper.showStatusMessage(getCurrFlame(), flames.size() + " " + (flames.size() > 1 ? "flames" : "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) ArrayList(java.util.ArrayList) File(java.io.File) Flame(org.jwildfire.create.tina.base.Flame) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame)

Example 12 with FlameWriter

use of org.jwildfire.create.tina.io.FlameWriter in project JWildfire by thargor6.

the class TinaController method sendCurrentFlameToBatchRenderer.

public void sendCurrentFlameToBatchRenderer() {
    try {
        Flame flame = getCurrFlame();
        if (flame != null) {
            String filename = qsaveFilenameGen.generateNextFilename();
            new FlameWriter().writeFlame(generateExportFlame(flame), filename);
            batchRendererController.importFlame(filename, getResolutionProfile(), getQualityProfile());
            messageHelper.showStatusMessage(getCurrFlame(), "sent as file <" + new File(filename).getName() + "> to batch-renderer");
        }
    } catch (Exception ex) {
        errorHandler.handleError(ex);
    }
}
Also used : FlameWriter(org.jwildfire.create.tina.io.FlameWriter) File(java.io.File) Flame(org.jwildfire.create.tina.base.Flame) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame)

Example 13 with FlameWriter

use of org.jwildfire.create.tina.io.FlameWriter in project JWildfire by thargor6.

the class TinaController method saveFlameToClipboard.

public void saveFlameToClipboard() {
    try {
        if (getCurrFlame() != null) {
            Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
            String xml = new FlameWriter().getFlameXML(generateExportFlame(getCurrFlame()));
            StringSelection data = new StringSelection(xml);
            clipboard.setContents(data, data);
            messageHelper.showStatusMessage(getCurrFlame(), "flame saved to clipboard");
        }
    } catch (Throwable ex) {
        errorHandler.handleError(ex);
    }
}
Also used : FlameWriter(org.jwildfire.create.tina.io.FlameWriter) Clipboard(java.awt.datatransfer.Clipboard) StringSelection(java.awt.datatransfer.StringSelection)

Example 14 with FlameWriter

use of org.jwildfire.create.tina.io.FlameWriter in project JWildfire by thargor6.

the class TinaInteractiveRendererController method toClipboardButton_clicked.

public void toClipboardButton_clicked() {
    try {
        Flame currFlame = getCurrFlame();
        if (currFlame != null) {
            Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
            String xml = new FlameWriter().getFlameXML(currFlame);
            StringSelection data = new StringSelection(xml);
            clipboard.setContents(data, data);
        }
    } catch (Throwable ex) {
        errorHandler.handleError(ex);
    }
}
Also used : FlameWriter(org.jwildfire.create.tina.io.FlameWriter) Clipboard(java.awt.datatransfer.Clipboard) Flame(org.jwildfire.create.tina.base.Flame) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame) StringSelection(java.awt.datatransfer.StringSelection)

Example 15 with FlameWriter

use of org.jwildfire.create.tina.io.FlameWriter in project JWildfire by thargor6.

the class TinaInteractiveRendererController method saveFlameButton_clicked.

public void saveFlameButton_clicked() {
    try {
        Flame currFlame = getCurrFlame();
        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(imageRootPanel) == JFileChooser.APPROVE_OPTION) {
                File file = chooser.getSelectedFile();
                new FlameWriter().writeFlame(currFlame, file.getAbsolutePath());
                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) Flame(org.jwildfire.create.tina.base.Flame) 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