Search in sources :

Example 1 with RandomGradientGenerator

use of org.jwildfire.create.tina.randomgradient.RandomGradientGenerator in project JWildfire by thargor6.

the class TinaInternalFrame method getRandomBatchButton.

/**
 * This method initializes randomBatchButton
 *
 * @return javax.swing.JButton
 */
private JButton getRandomBatchButton() {
    if (randomBatchButton == null) {
        randomBatchButton = new JButton();
        randomBatchButton.setToolTipText("Create a batch of random flames");
        randomBatchButton.setMaximumSize(new Dimension(32000, 46));
        randomBatchButton.setMinimumSize(new Dimension(100, 46));
        randomBatchButton.setFont(Prefs.getPrefs().getFont("Dialog", Font.BOLD, 10));
        randomBatchButton.setText("Random batch");
        randomBatchButton.setPreferredSize(new Dimension(115, 46));
        randomBatchButton.setIcon(new ImageIcon(TinaInternalFrame.class.getResource("/org/jwildfire/swing/icons/new/roll.png")));
        randomBatchButton.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent e) {
                RandomFlameGenerator randGen = RandomFlameGeneratorList.getRandomFlameGeneratorInstance((String) randomStyleCmb.getSelectedItem(), true);
                RandomSymmetryGenerator randSymmGen = RandomSymmetryGeneratorList.getRandomSymmetryGeneratorInstance((String) randomSymmetryCmb.getSelectedItem(), true);
                RandomGradientGenerator randGradientGen = RandomGradientGeneratorList.getRandomGradientGeneratorInstance((String) randomGradientCmb.getSelectedItem(), true);
                if (tinaController.createRandomBatch(-1, randGen, randSymmGen, randGradientGen, RandomBatchQuality.NORMAL)) {
                    tinaController.importFromRandomBatch(0);
                }
            }
        });
    }
    return randomBatchButton;
}
Also used : ImageIcon(javax.swing.ImageIcon) RandomGradientGenerator(org.jwildfire.create.tina.randomgradient.RandomGradientGenerator) ActionListener(java.awt.event.ActionListener) JButton(javax.swing.JButton) Dimension(java.awt.Dimension) RandomSymmetryGenerator(org.jwildfire.create.tina.randomsymmetry.RandomSymmetryGenerator) ActionEvent(java.awt.event.ActionEvent) RandomFlameGenerator(org.jwildfire.create.tina.randomflame.RandomFlameGenerator)

Example 2 with RandomGradientGenerator

use of org.jwildfire.create.tina.randomgradient.RandomGradientGenerator in project JWildfire by thargor6.

the class JWildfire method getMainDesktopPane.

private JDesktopPane getMainDesktopPane() {
    if (mainDesktopPane == null) {
        mainDesktopPane = createMainDesktopPane();
        for (InternalFrameHolder<?> internalFrame : mainInternalFrames) {
            mainDesktopPane.add(internalFrame.getInternalFrame());
        }
        getInternalFrame(NavigatorInternalFrame.class).setDesktop(this);
        TinaInternalFrame tinaInternalFrame = getInternalFrame(TinaInternalFrame.class);
        tinaInternalFrame.addComponentListener(new java.awt.event.ComponentAdapter() {

            public void componentResized(java.awt.event.ComponentEvent e) {
                tinaController.refreshFlameImage(true, false, 1, true, false);
            }
        });
        if (!tinaInternalFrame.isVisible()) {
            tinaInternalFrame.setVisible(true);
        }
        for (InternalFrameHolder<?> internalFrame : settingsInternalFrames) {
            mainDesktopPane.add(internalFrame.getInternalFrame());
        }
        for (InternalFrameHolder<?> internalFrame : helpInternalFrames) {
            mainDesktopPane.add(internalFrame.getInternalFrame());
        }
        errorHandler = new StandardErrorHandler(mainDesktopPane, getShowErrorDlg(), getShowErrorDlgMessageTextArea(), getShowErrorDlgStacktraceTextArea());
        NavigatorInternalFrame navigatorInternalFrame = getInternalFrame(NavigatorInternalFrame.class);
        if (!navigatorInternalFrame.isVisible()) {
            navigatorInternalFrame.setVisible(true);
        }
        navigatorInternalFrame.moveToFront();
        /*
            WelcomeInternalFrame welcomeInternalFrame = getInternalFrame(WelcomeInternalFrame.class);
            if (!welcomeInternalFrame.isVisible()) {
              welcomeInternalFrame.setVisible(true);
            }
            welcomeInternalFrame.moveToFront();
      */
        TipOfTheDayInternalFrame tipOfTheDayInternalFrame = getInternalFrame(TipOfTheDayInternalFrame.class);
        if (!tipOfTheDayInternalFrame.isVisible() && Prefs.getPrefs().isShowTipsAtStartup()) {
            tipOfTheDayInternalFrame.setVisible(true);
        }
        tipOfTheDayInternalFrame.moveToFront();
        try {
            getInternalFrame(ListOfChangesInternalFrame.class).initChangesPane();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        try {
            getInternalFrame(GPURenderInfoInternalFrame.class).initChangesPane();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        MutaGenInternalFrame mutaGenFrame = getInternalFrame(MutaGenInternalFrame.class);
        FlameBrowserInternalFrame flameBrowserFrame = getInternalFrame(FlameBrowserInternalFrame.class);
        EasyMovieMakerInternalFrame easyMovieMakerFrame = getInternalFrame(EasyMovieMakerInternalFrame.class);
        DancingFlamesInternalFrame dancingFlamesFrame = getInternalFrame(DancingFlamesInternalFrame.class);
        BatchFlameRendererInternalFrame batchFlameRendererFrame = getInternalFrame(BatchFlameRendererInternalFrame.class);
        MeshGenInternalFrame meshGenFrame = getInternalFrame(MeshGenInternalFrame.class);
        InteractiveRendererInternalFrame interactiveRendererFrame = getInternalFrame(InteractiveRendererInternalFrame.class);
        VariationsSettingsInternalFrame variationsSettingsFrame = getInternalFrame(VariationsSettingsInternalFrame.class);
        // create some unregistered window even when FACLRender is not available, in order to avoid further null-checks etc.
        FlamesGPURenderInternalFrame gpuRendererFrame = FACLRenderTools.isFaclRenderAvalailable() ? getInternalFrame(FlamesGPURenderInternalFrame.class) : new FlamesGPURenderInternalFrame();
        HelpInternalFrame helpFrame = getInternalFrame(HelpInternalFrame.class);
        TinaInternalFrame tinaFrame = getInternalFrame(TinaInternalFrame.class);
        tinaController = tinaFrame.createController(this, errorHandler, prefs, mutaGenFrame, flameBrowserFrame, easyMovieMakerFrame, dancingFlamesFrame, batchFlameRendererFrame, meshGenFrame, interactiveRendererFrame, gpuRendererFrame, helpFrame);
        try {
            RandomFlameGenerator randGen = RandomFlameGeneratorList.getRandomFlameGeneratorInstance(RandomFlameGeneratorList.DEFAULT_GENERATOR_NAME, true);
            if (randGen instanceof AllRandomFlameGenerator) {
                ((AllRandomFlameGenerator) randGen).setUseSimpleGenerators(true);
            }
            RandomSymmetryGenerator randSymmGen = RandomSymmetryGeneratorList.getRandomSymmetryGeneratorInstance(RandomSymmetryGeneratorList.DEFAULT_GENERATOR_NAME, true);
            RandomGradientGenerator randGradientGen = RandomGradientGeneratorList.getRandomGradientGeneratorInstance((RandomGradientGeneratorList.DEFAULT_GENERATOR_NAME), true);
            tinaController.createRandomBatch(2, randGen, randSymmGen, randGradientGen, RandomBatchQuality.LOW);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        flameBrowserFrame.setTinaController(tinaController);
        mutaGenFrame.setTinaController(tinaController);
        easyMovieMakerFrame.setTinaController(tinaController);
        dancingFlamesFrame.setTinaController(tinaController);
        batchFlameRendererFrame.setTinaController(tinaController);
        variationsSettingsFrame.setTinaController(tinaController);
        meshGenFrame.setTinaController(tinaController);
        interactiveRendererFrame.setTinaController(tinaController);
        gpuRendererFrame.setTinaController(tinaController);
        helpFrame.setTinaController(tinaController);
        FormulaExplorerInternalFrame formulaExplorerFrame = getInternalFrame(FormulaExplorerInternalFrame.class);
        formulaExplorerController = new FormulaExplorerController((FormulaPanel) formulaExplorerFrame.getFormulaPanel(), formulaExplorerFrame.getFormulaExplorerFormula1REd(), formulaExplorerFrame.getFormulaExplorerFormula2REd(), formulaExplorerFrame.getFormulaExplorerFormula3REd(), formulaExplorerFrame.getFormulaExplorerFormulaXMinREd(), formulaExplorerFrame.getFormulaExplorerFormulaXMaxREd(), formulaExplorerFrame.getFormulaExplorerFormulaXCountREd(), formulaExplorerFrame.getFormulaExplorerValuesTextArea());
        OperatorsInternalFrame operatorsFrame = getInternalFrame(OperatorsInternalFrame.class);
        operatorsFrame.setDesktop(this);
        PreferencesInternalFrame preferencesFrame = getInternalFrame(PreferencesInternalFrame.class);
        preferencesFrame.setDesktop(this);
        preferencesFrame.setPrefs(prefs);
        preferencesFrame.setMainController(mainController);
        mainController = new MainController(prefs, errorHandler, mainDesktopPane, getWindowMenu(), operatorsFrame.getTransformerInputCmb(), operatorsFrame.getTransformerPresetCmb(), operatorsFrame.getCreatorPresetCmb(), getShowMessageDlg(), getShowMessageDlgTextArea(), null, null, null, null, null, null, null, mainInternalFrames.size());
        /*
      EDENInternalFrame edenFrame = (EDENInternalFrame) getEDENInternalFrame();
      edenFrame.createController(mainController, errorHandler, prefs).newEmptyScene();
      */
        IFlamesInternalFrame iflamesInternalFrame = getInternalFrame(IFlamesInternalFrame.class);
        iflamesInternalFrame.createController(mainController, tinaController, errorHandler);
        tinaController.setMainController(mainController);
        operatorsFrame.setMainController(mainController);
        formulaExplorerFrame.setMainController(mainController);
        formulaExplorerFrame.setFormulaExplorerController(formulaExplorerController);
    }
    try {
        getInternalFrame(WelcomeInternalFrame.class).setSelected(true);
    } catch (PropertyVetoException ex) {
        ex.printStackTrace();
    }
    return mainDesktopPane;
}
Also used : HelpInternalFrame(org.jwildfire.create.tina.swing.HelpInternalFrame) TinaInternalFrame(org.jwildfire.create.tina.swing.TinaInternalFrame) InteractiveRendererInternalFrame(org.jwildfire.create.tina.swing.InteractiveRendererInternalFrame) MeshGenInternalFrame(org.jwildfire.create.tina.swing.MeshGenInternalFrame) BatchFlameRendererInternalFrame(org.jwildfire.create.tina.swing.BatchFlameRendererInternalFrame) EasyMovieMakerInternalFrame(org.jwildfire.create.tina.swing.EasyMovieMakerInternalFrame) FlamesGPURenderInternalFrame(org.jwildfire.create.tina.swing.FlamesGPURenderInternalFrame) AllRandomFlameGenerator(org.jwildfire.create.tina.randomflame.AllRandomFlameGenerator) RandomFlameGenerator(org.jwildfire.create.tina.randomflame.RandomFlameGenerator) FlameBrowserInternalFrame(org.jwildfire.create.tina.swing.FlameBrowserInternalFrame) MutaGenInternalFrame(org.jwildfire.create.tina.swing.MutaGenInternalFrame) RandomGradientGenerator(org.jwildfire.create.tina.randomgradient.RandomGradientGenerator) AllRandomFlameGenerator(org.jwildfire.create.tina.randomflame.AllRandomFlameGenerator) NavigatorInternalFrame(org.jwildfire.create.tina.swing.NavigatorInternalFrame) VariationsSettingsInternalFrame(org.jwildfire.create.tina.swing.VariationsSettingsInternalFrame) PropertyVetoException(java.beans.PropertyVetoException) PropertyVetoException(java.beans.PropertyVetoException) IFlamesInternalFrame(org.jwildfire.create.iflames.swing.IFlamesInternalFrame) RandomSymmetryGenerator(org.jwildfire.create.tina.randomsymmetry.RandomSymmetryGenerator) DancingFlamesInternalFrame(org.jwildfire.create.tina.swing.DancingFlamesInternalFrame)

Example 3 with RandomGradientGenerator

use of org.jwildfire.create.tina.randomgradient.RandomGradientGenerator in project JWildfire by thargor6.

the class TinaController method newFlameButton_clicked.

public void newFlameButton_clicked() {
    Flame flame = new Flame();
    flame.setWidth(800);
    flame.setHeight(600);
    flame.setPixelsPerUnit(50);
    flame.setBGTransparency(prefs.isTinaDefaultBGTransparency());
    RandomGradientGenerator gradientGen = RandomGradientGeneratorList.getRandomGradientGeneratorInstance((String) data.paletteRandomGeneratorCmb.getSelectedItem());
    RGBPalette palette = gradientGen.generatePalette(Integer.parseInt(data.paletteRandomPointsREd.getText()), data.paletteFadeColorsCBx.isSelected(), data.paletteUniformWidthCBx.isSelected());
    flame.getFirstLayer().setPalette(palette);
    setLastGradient(palette);
    setCurrFlame(flame);
    undoManager.initUndoStack(getCurrFlame());
}
Also used : RandomGradientGenerator(org.jwildfire.create.tina.randomgradient.RandomGradientGenerator) RGBPalette(org.jwildfire.create.tina.palette.RGBPalette) Flame(org.jwildfire.create.tina.base.Flame) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame)

Example 4 with RandomGradientGenerator

use of org.jwildfire.create.tina.randomgradient.RandomGradientGenerator in project JWildfire by thargor6.

the class TinaController method randomPaletteButton_actionPerformed.

public void randomPaletteButton_actionPerformed(ActionEvent e) {
    if (getCurrFlame() != null) {
        RandomGradientGenerator gradientGen = RandomGradientGeneratorList.getRandomGradientGeneratorInstance((String) data.paletteRandomGeneratorCmb.getSelectedItem());
        data.paletteKeyFrames = gradientGen.generateKeyFrames(Integer.parseInt(data.paletteRandomPointsREd.getText()));
        refreshPaletteColorsTable();
        RGBPalette palette = RandomGradientGenerator.generatePalette(data.paletteKeyFrames, data.paletteFadeColorsCBx.isSelected(), data.paletteUniformWidthCBx.isSelected());
        saveUndoPoint();
        getCurrLayer().setPalette(palette);
        setLastGradient(palette);
        refreshPaletteUI(palette);
        refreshFlameImage(true, false, 1, true, false);
    }
}
Also used : RandomGradientGenerator(org.jwildfire.create.tina.randomgradient.RandomGradientGenerator) RGBPalette(org.jwildfire.create.tina.palette.RGBPalette)

Aggregations

RandomGradientGenerator (org.jwildfire.create.tina.randomgradient.RandomGradientGenerator)4 RGBPalette (org.jwildfire.create.tina.palette.RGBPalette)2 RandomFlameGenerator (org.jwildfire.create.tina.randomflame.RandomFlameGenerator)2 RandomSymmetryGenerator (org.jwildfire.create.tina.randomsymmetry.RandomSymmetryGenerator)2 Dimension (java.awt.Dimension)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 PropertyVetoException (java.beans.PropertyVetoException)1 ImageIcon (javax.swing.ImageIcon)1 JButton (javax.swing.JButton)1 IFlamesInternalFrame (org.jwildfire.create.iflames.swing.IFlamesInternalFrame)1 Flame (org.jwildfire.create.tina.base.Flame)1 AllRandomFlameGenerator (org.jwildfire.create.tina.randomflame.AllRandomFlameGenerator)1 RenderedFlame (org.jwildfire.create.tina.render.RenderedFlame)1 BatchFlameRendererInternalFrame (org.jwildfire.create.tina.swing.BatchFlameRendererInternalFrame)1 DancingFlamesInternalFrame (org.jwildfire.create.tina.swing.DancingFlamesInternalFrame)1 EasyMovieMakerInternalFrame (org.jwildfire.create.tina.swing.EasyMovieMakerInternalFrame)1 FlameBrowserInternalFrame (org.jwildfire.create.tina.swing.FlameBrowserInternalFrame)1 FlamesGPURenderInternalFrame (org.jwildfire.create.tina.swing.FlamesGPURenderInternalFrame)1 HelpInternalFrame (org.jwildfire.create.tina.swing.HelpInternalFrame)1