Search in sources :

Example 76 with Flame

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

the class AbstractControlsDelegate method editMotionCurve.

protected void editMotionCurve(MotionCurve pCurve, double pInitialValue, String pPropName, String pLabel) {
    Envelope envelope = pCurve.toEnvelope();
    if (envelope.getX().length == 0) {
        int[] x = new int[] { 0 };
        if (pInitialValue <= envelope.getViewYMin() + 1) {
            envelope.setViewYMin(pInitialValue - 1.0);
        }
        if (pInitialValue >= envelope.getViewYMax() - 1) {
            envelope.setViewYMax(pInitialValue + 1.0);
        }
        double[] y = new double[] { pInitialValue };
        envelope.setValues(x, y);
    }
    EnvelopeDialog dlg = new EnvelopeDialog(SwingUtilities.getWindowAncestor(rootPanel), owner.getErrorHandler(), envelope, true);
    dlg.setFlameToPreview(EnvelopeDialogFlamePreviewType.MOTION_CURVE, owner.getCurrFlame(), pCurve);
    dlg.setTitle("Editing " + pLabel);
    dlg.setModal(true);
    dlg.setVisible(true);
    if (dlg.isConfirmed()) {
        Flame flame = owner.getCurrFlame();
        if (useUndoManager) {
            owner.undoManager.saveUndoPoint(flame);
        }
        if (dlg.isRemoved()) {
            pCurve.setEnabled(false);
        } else {
            pCurve.assignFromEnvelope(envelope);
            pCurve.setEnabled(true);
        }
        owner.refreshFlameImage(true, false, 1, true, false);
    }
}
Also used : Envelope(org.jwildfire.envelope.Envelope) Flame(org.jwildfire.create.tina.base.Flame)

Example 77 with Flame

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

the class TinaController method xFormModGammaRandomizeBtn_Clicked.

public void xFormModGammaRandomizeBtn_Clicked(boolean pWholeFractal) {
    if (pWholeFractal) {
        Flame flame = getCurrFlame();
        if (flame != null) {
            saveUndoPoint();
            for (Layer layer : flame.getLayers()) {
                for (XForm xForm : layer.getXForms()) {
                    xForm.randomizeModGamma();
                }
            }
            refreshXFormUI(getCurrXForm(XFormType.BOTH));
            refreshFlameImage(true, false, 1, true, false);
        }
    } else {
        XForm xForm = getCurrXForm(XFormType.NORMAL);
        if (xForm != null) {
            saveUndoPoint();
            xForm.randomizeModGamma();
            refreshXFormUI(xForm);
            refreshFlameImage(true, false, 1, true, false);
        }
    }
}
Also used : XForm(org.jwildfire.create.tina.base.XForm) Layer(org.jwildfire.create.tina.base.Layer) Flame(org.jwildfire.create.tina.base.Flame) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame)

Example 78 with Flame

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

the class TinaController method xFormModLocalGammaResetAllBtn_Clicked.

public void xFormModLocalGammaResetAllBtn_Clicked(boolean pWholeFractal) {
    if (pWholeFractal) {
        Flame flame = getCurrFlame();
        if (flame != null) {
            saveUndoPoint();
            for (Layer layer : flame.getLayers()) {
                for (XForm xForm : layer.getXForms()) {
                    xForm.resetModColorEffects();
                }
            }
            refreshXFormUI(getCurrXForm(XFormType.BOTH));
            refreshFlameImage(true, false, 1, true, false);
        }
    } else {
        XForm xForm = getCurrXForm(XFormType.NORMAL);
        if (xForm != null) {
            saveUndoPoint();
            xForm.resetModColorEffects();
            refreshXFormUI(xForm);
            refreshFlameImage(true, false, 1, true, false);
        }
    }
}
Also used : XForm(org.jwildfire.create.tina.base.XForm) Layer(org.jwildfire.create.tina.base.Layer) Flame(org.jwildfire.create.tina.base.Flame) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame)

Example 79 with Flame

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

the class TinaController method getCurrFlame.

@Override
public Flame getCurrFlame(boolean autoGenerateIfEmpty) {
    if (_currFlame == null) {
        final int IMG_WIDTH = 80;
        final int IMG_HEIGHT = 60;
        RandomFlameGenerator randGen = new AllRandomFlameGenerator();
        int palettePoints = 3 + Tools.randomInt(21);
        boolean fadePaletteColors = Math.random() > 0.09;
        boolean uniformWidth = Math.random() > 0.75;
        RandomFlameGeneratorSampler sampler = new RandomFlameGeneratorSampler(IMG_WIDTH, IMG_HEIGHT, prefs, randGen, RandomSymmetryGeneratorList.SPARSE, RandomGradientGeneratorList.DEFAULT, palettePoints, fadePaletteColors, uniformWidth, RandomBatchQuality.LOW);
        Flame flame = sampler.createSample().getFlame();
        setCurrFlame(flame);
    }
    return _currFlame;
}
Also used : AllRandomFlameGenerator(org.jwildfire.create.tina.randomflame.AllRandomFlameGenerator) RandomFlameGeneratorSampler(org.jwildfire.create.tina.randomflame.RandomFlameGeneratorSampler) AllRandomFlameGenerator(org.jwildfire.create.tina.randomflame.AllRandomFlameGenerator) RandomFlameGenerator(org.jwildfire.create.tina.randomflame.RandomFlameGenerator) WikimediaCommonsRandomFlameGenerator(org.jwildfire.create.tina.randomflame.WikimediaCommonsRandomFlameGenerator) Flame(org.jwildfire.create.tina.base.Flame) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame)

Example 80 with Flame

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

the class TinaController method randomizeColorSpeedBtn_clicked.

public void randomizeColorSpeedBtn_clicked() {
    Flame flame = getCurrFlame();
    if (flame != null) {
        saveUndoPoint();
        getCurrLayer().randomizeColorSpeed();
        transformationChanged(true);
    }
}
Also used : 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