Search in sources :

Example 11 with FlameReader

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

the class TinaController method grabPaletteFromFlameButton_actionPerformed.

public void grabPaletteFromFlameButton_actionPerformed(ActionEvent e) {
    JFileChooser chooser = new FlameFileChooser(prefs);
    if (prefs.getInputFlamePath() != null) {
        try {
            chooser.setCurrentDirectory(new File(prefs.getInputFlamePath()));
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
    if (chooser.showOpenDialog(centerPanel) == JFileChooser.APPROVE_OPTION) {
        File file = chooser.getSelectedFile();
        List<Flame> flames = new FlameReader(prefs).readFlames(file.getAbsolutePath());
        Flame flame = flames.get(0);
        prefs.setLastInputFlameFile(file);
        RGBPalette palette = flame.getFirstLayer().getPalette();
        data.paletteKeyFrames = null;
        saveUndoPoint();
        getCurrLayer().setPalette(palette);
        setLastGradient(palette);
        refreshPaletteColorsTable();
        refreshPaletteUI(palette);
        refreshFlameImage(true, false, 1, true, false);
    }
}
Also used : JFileChooser(javax.swing.JFileChooser) FlameReader(org.jwildfire.create.tina.io.FlameReader) RGBPalette(org.jwildfire.create.tina.palette.RGBPalette) File(java.io.File) Flame(org.jwildfire.create.tina.base.Flame) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame)

Example 12 with FlameReader

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

the class MeshGenController method loadFlameButton_clicked.

public void loadFlameButton_clicked() {
    try {
        JFileChooser chooser = new FlameFileChooser(prefs);
        if (prefs.getInputFlamePath() != null) {
            try {
                chooser.setCurrentDirectory(new File(prefs.getInputFlamePath()));
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
        if (chooser.showOpenDialog(rootPanel) == JFileChooser.APPROVE_OPTION) {
            File file = chooser.getSelectedFile();
            List<Flame> flames = new FlameReader(prefs).readFlames(file.getAbsolutePath());
            Flame newFlame = flames.get(0);
            prefs.setLastInputFlameFile(file);
            importFlame(newFlame);
        }
    } catch (Throwable ex) {
        errorHandler.handleError(ex);
    }
}
Also used : JFileChooser(javax.swing.JFileChooser) FlameReader(org.jwildfire.create.tina.io.FlameReader) 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 13 with FlameReader

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

the class CacheRendererThread method renderFlame.

private SimpleImage renderFlame(FlameFlatNode pNode, int pImgWidth, int pImgHeight) {
    List<Flame> flames = new FlameReader(prefs).readFlames(pNode.getFilename());
    if (flames.size() > 0) {
        Flame renderFlame = flames.get(0);
        RenderInfo info = new RenderInfo(pImgWidth, pImgHeight, RenderMode.PREVIEW);
        double wScl = (double) info.getImageWidth() / (double) renderFlame.getWidth();
        double hScl = (double) info.getImageHeight() / (double) renderFlame.getHeight();
        renderFlame.setPixelsPerUnit((wScl + hScl) * 0.5 * renderFlame.getPixelsPerUnit());
        renderFlame.setWidth(pImgWidth);
        renderFlame.setHeight(pImgHeight);
        renderFlame.setSampleDensity(prefs.getTinaRenderPreviewQuality() / 3.0);
        FlameRenderer renderer = new FlameRenderer(renderFlame, prefs, false, true);
        RenderedFlame renderRes = renderer.renderFlame(info);
        return renderRes.getImage();
    }
    return null;
}
Also used : FlameReader(org.jwildfire.create.tina.io.FlameReader) FlameRenderer(org.jwildfire.create.tina.render.FlameRenderer) RenderInfo(org.jwildfire.create.tina.render.RenderInfo) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame) Flame(org.jwildfire.create.tina.base.Flame) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame)

Example 14 with FlameReader

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

the class BatchRendererController method showImageBtn_clicked.

public void showImageBtn_clicked() {
    try {
        Job job = getCurrJob();
        if (job != null) {
            List<Flame> flames = new FlameReader(Prefs.getPrefs()).readFlames(job.getFlameFilename());
            Flame flame = flames.get(0);
            String primaryFilename = job.getImageFilename(flame.getStereo3dMode());
            File imageFile = new File(primaryFilename);
            if (imageFile.exists()) {
                tinaController.getMainController().loadImage(imageFile.getAbsolutePath(), false);
            } else {
                StandardDialogs.message(rootPanel, "No rendered image found");
            }
        }
    } catch (Throwable ex) {
        errorHandler.handleError(ex);
    }
}
Also used : FlameReader(org.jwildfire.create.tina.io.FlameReader) File(java.io.File) Flame(org.jwildfire.create.tina.base.Flame) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame)

Example 15 with FlameReader

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

the class IFlamesController method loadIFlameButton_clicked.

public void loadIFlameButton_clicked() {
    try {
        JFileChooser chooser = new FlameFileChooser(prefs);
        if (prefs.getInputFlamePath() != null) {
            try {
                chooser.setCurrentDirectory(new File(prefs.getInputFlamePath()));
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
        if (chooser.showOpenDialog(centerPanel) == JFileChooser.APPROVE_OPTION) {
            File file = chooser.getSelectedFile();
            List<Flame> flames = new FlameReader(prefs).readFlames(file.getAbsolutePath());
            Flame flame = flames.get(0);
            prefs.setLastInputFlameFile(file);
            importFlame(flame);
            getFlame().setLastFilename(file.getName());
            messageHelper.showStatusMessage(getFlame(), "opened from disc");
        }
    } catch (Throwable ex) {
        errorHandler.handleError(ex);
    }
}
Also used : JFileChooser(javax.swing.JFileChooser) FlameReader(org.jwildfire.create.tina.io.FlameReader) 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)

Aggregations

FlameReader (org.jwildfire.create.tina.io.FlameReader)25 Flame (org.jwildfire.create.tina.base.Flame)24 RenderedFlame (org.jwildfire.create.tina.render.RenderedFlame)20 File (java.io.File)12 JFileChooser (javax.swing.JFileChooser)10 Clipboard (java.awt.datatransfer.Clipboard)7 Transferable (java.awt.datatransfer.Transferable)7 FlameFileChooser (org.jwildfire.create.tina.swing.FlameFileChooser)5 FlameRenderer (org.jwildfire.create.tina.render.FlameRenderer)3 RenderInfo (org.jwildfire.create.tina.render.RenderInfo)3 ArrayList (java.util.ArrayList)2 ThumbnailCacheKey (org.jwildfire.create.tina.swing.ThumbnailCacheKey)2 HashMap (java.util.HashMap)1 ImageIcon (javax.swing.ImageIcon)1 XForm (org.jwildfire.create.tina.base.XForm)1 FACLFlameWriter (org.jwildfire.create.tina.faclrender.FACLFlameWriter)1 FACLRenderResult (org.jwildfire.create.tina.faclrender.FACLRenderResult)1 FlameWriter (org.jwildfire.create.tina.io.FlameWriter)1 RGBPalette (org.jwildfire.create.tina.palette.RGBPalette)1 Variation (org.jwildfire.create.tina.variation.Variation)1