Search in sources :

Example 96 with Flame

use of org.jwildfire.create.tina.base.Flame in project JWildfire by thargor6.

the class TinaController method enableLayerControls.

private void enableLayerControls() {
    Flame flame = getCurrFlame();
    Layer layer = getCurrLayer();
    data.layerWeightEd.setEnabled(layer != null);
    data.layerAddBtn.setEnabled(flame != null);
    data.layerDuplicateBtn.setEnabled(layer != null);
    data.layerDeleteBtn.setEnabled(flame != null && layer != null && getCurrFlame().getLayers().size() > 1);
    data.layersTable.setEnabled(flame != null);
    data.layerVisibleBtn.setEnabled(layer != null);
    data.layerAppendBtn.setEnabled(flame != null);
    data.layerPreviewBtn.setEnabled(flame != null);
    data.layerHideOthersBtn.setEnabled(layer != null);
    data.layerShowAllBtn.setEnabled(flame != null);
}
Also used : Layer(org.jwildfire.create.tina.base.Layer) Flame(org.jwildfire.create.tina.base.Flame) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame)

Example 97 with Flame

use of org.jwildfire.create.tina.base.Flame 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 98 with Flame

use of org.jwildfire.create.tina.base.Flame 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)

Example 99 with Flame

use of org.jwildfire.create.tina.base.Flame in project JWildfire by thargor6.

the class TinaInteractiveRendererController method fromEditorButton_clicked.

public void fromEditorButton_clicked() {
    try {
        Flame newFlame = parentCtrl.exportFlame();
        if (newFlame != null) {
            currFlame = newFlame;
            storeCurrFlame();
            cancelRender();
            setupProfiles(currFlame);
            renderButton_clicked();
            enableControls();
        }
    } catch (Throwable ex) {
        errorHandler.handleError(ex);
    }
}
Also used : Flame(org.jwildfire.create.tina.base.Flame) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame)

Example 100 with Flame

use of org.jwildfire.create.tina.base.Flame in project JWildfire by thargor6.

the class TinaInteractiveRendererController method resumeBtn_clicked.

public void resumeBtn_clicked() {
    try {
        JFileChooser chooser = new JWFRenderFileChooser(prefs);
        if (prefs.getInputFlamePath() != null) {
            try {
                chooser.setCurrentDirectory(new File(prefs.getInputFlamePath()));
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
        if (chooser.showOpenDialog(imageRootPanel) == JFileChooser.APPROVE_OPTION) {
            cancelRender();
            File file = chooser.getSelectedFile();
            Flame newFlame = new Flame();
            FlameRenderer newRenderer = new FlameRenderer(newFlame, prefs, newFlame.isBGTransparency(), false);
            ResumedFlameRender resumedRender = newRenderer.resumeRenderFlame(file.getAbsolutePath());
            threads = new RenderThreads(resumedRender.getThreads(), new ArrayList<Thread>());
            Flame flame = currFlame = newRenderer.getFlame();
            // setup size profile
            {
                int width = newRenderer.getRenderInfo().getImageWidth();
                int height = newRenderer.getRenderInfo().getImageHeight();
                ResolutionProfile selected = null;
                boolean full = false;
                boolean halve = false;
                boolean quarter = false;
                for (int i = 0; i < interactiveResolutionProfileCmb.getItemCount(); i++) {
                    ResolutionProfile profile = (ResolutionProfile) interactiveResolutionProfileCmb.getItemAt(i);
                    if (profile.getWidth() == width && profile.getHeight() == height) {
                        selected = profile;
                        full = true;
                        break;
                    }
                }
                if (selected == null) {
                    for (int i = 0; i < interactiveResolutionProfileCmb.getItemCount(); i++) {
                        ResolutionProfile profile = (ResolutionProfile) interactiveResolutionProfileCmb.getItemAt(i);
                        if (profile.getWidth() / 2 == width && profile.getHeight() / 2 == height) {
                            selected = profile;
                            halve = true;
                            break;
                        }
                    }
                }
                if (selected == null) {
                    for (int i = 0; i < interactiveResolutionProfileCmb.getItemCount(); i++) {
                        ResolutionProfile profile = (ResolutionProfile) interactiveResolutionProfileCmb.getItemAt(i);
                        if (profile.getWidth() / 4 == width && profile.getHeight() / 4 == height) {
                            selected = profile;
                            quarter = true;
                            break;
                        }
                    }
                }
                if (selected == null) {
                    selected = new ResolutionProfile(false, width, height);
                    full = true;
                    interactiveResolutionProfileCmb.addItem(selected);
                }
                boolean wasQuarterSelected = quarterSizeButton.isSelected();
                boolean wasHalveSelected = halveSizeButton.isSelected();
                boolean wasFullSelected = fullSizeButton.isSelected();
                refreshing = true;
                try {
                    quarterSizeButton.setSelected(quarter);
                    halveSizeButton.setSelected(halve);
                    fullSizeButton.setSelected(full);
                } finally {
                    refreshing = false;
                }
                ResolutionProfile currSel = (ResolutionProfile) interactiveResolutionProfileCmb.getSelectedItem();
                if (currSel == null || !currSel.equals(selected) || wasQuarterSelected != quarter || wasHalveSelected != halve || wasFullSelected != full) {
                    interactiveResolutionProfileCmb.setSelectedItem(selected);
                    refreshImagePanel();
                } else {
                    clearScreen();
                }
            }
            // 
            renderer = newRenderer;
            setupProfiles(currFlame);
            if (flame.getBgColorRed() > 0 || flame.getBgColorGreen() > 0 || flame.getBgColorBlue() > 0) {
                image.fillBackground(flame.getBgColorRed(), flame.getBgColorGreen(), flame.getBgColorBlue());
            }
            renderer.registerIterationObserver(this);
            displayUpdater = createDisplayUpdater();
            displayUpdater.initRender(threads.getRenderThreads().size());
            pausedRenderTime = resumedRender.getHeader().getElapsedMilliseconds();
            renderStartTime = System.currentTimeMillis();
            lastQuality = 0.0;
            lastQualitySpeed = 0.0;
            lastQualityTime = 0;
            for (int i = 0; i < threads.getRenderThreads().size(); i++) {
                AbstractRenderThread rThread = threads.getRenderThreads().get(i);
                Thread eThread = startRenderThread(rThread);
                threads.getExecutingThreads().add(eThread);
            }
            updateDisplayThread = new UpdateDisplayThread();
            startDisplayThread(updateDisplayThread);
            state = State.RENDER;
            enableControls();
        }
    } catch (Throwable ex) {
        errorHandler.handleError(ex);
    }
}
Also used : ResolutionProfile(org.jwildfire.base.ResolutionProfile) ArrayList(java.util.ArrayList) XYZProjectedPoint(org.jwildfire.create.tina.base.XYZProjectedPoint) AbstractRenderThread(org.jwildfire.create.tina.render.AbstractRenderThread) RenderThreads(org.jwildfire.create.tina.render.RenderThreads) JFileChooser(javax.swing.JFileChooser) ResumedFlameRender(org.jwildfire.create.tina.render.ResumedFlameRender) FlameRenderer(org.jwildfire.create.tina.render.FlameRenderer) File(java.io.File) AbstractRenderThread(org.jwildfire.create.tina.render.AbstractRenderThread) Flame(org.jwildfire.create.tina.base.Flame) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame)

Aggregations

Flame (org.jwildfire.create.tina.base.Flame)232 RenderedFlame (org.jwildfire.create.tina.render.RenderedFlame)109 Layer (org.jwildfire.create.tina.base.Layer)63 XForm (org.jwildfire.create.tina.base.XForm)55 VariationFunc (org.jwildfire.create.tina.variation.VariationFunc)30 FlameRenderer (org.jwildfire.create.tina.render.FlameRenderer)27 FlameReader (org.jwildfire.create.tina.io.FlameReader)24 File (java.io.File)21 RenderInfo (org.jwildfire.create.tina.render.RenderInfo)21 ArrayList (java.util.ArrayList)17 JFileChooser (javax.swing.JFileChooser)17 SimpleImage (org.jwildfire.image.SimpleImage)17 FlameWriter (org.jwildfire.create.tina.io.FlameWriter)15 Rectangle (java.awt.Rectangle)10 Clipboard (java.awt.datatransfer.Clipboard)10 FlamePanel (org.jwildfire.create.tina.swing.flamepanel.FlamePanel)9 RGBPalette (org.jwildfire.create.tina.palette.RGBPalette)8 Transferable (java.awt.datatransfer.Transferable)7 ResolutionProfile (org.jwildfire.base.ResolutionProfile)7 Test (org.junit.Test)6