Search in sources :

Example 26 with RGBPalette

use of org.jwildfire.create.tina.palette.RGBPalette in project JWildfire by thargor6.

the class GradientController method gradientSaveBtn_clicked.

public void gradientSaveBtn_clicked() {
    try {
        Layer layer = tinaController.getCurrLayer();
        if (layer != null) {
            JFileChooser chooser = new MapFileChooser(prefs);
            if (prefs.getTinaGradientPath() != null) {
                try {
                    chooser.setCurrentDirectory(new File(prefs.getTinaGradientPath()));
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
            if (chooser.showSaveDialog(rootPanel) == JFileChooser.APPROVE_OPTION) {
                File file = chooser.getSelectedFile();
                RGBPalette gradient = layer.getPalette().makeCopy();
                gradient.setFlam3Name(file.getName());
                new MapGradientWriter().writeGradient(gradient, file.getAbsolutePath());
                tinaController.getMessageHelper().showStatusMessage(gradient, "gradient saved to disc");
            }
        }
    } catch (Throwable ex) {
        errorHandler.handleError(ex);
    }
}
Also used : MapGradientWriter(org.jwildfire.create.tina.io.MapGradientWriter) JFileChooser(javax.swing.JFileChooser) RGBPalette(org.jwildfire.create.tina.palette.RGBPalette) MapFileChooser(org.jwildfire.create.tina.swing.MapFileChooser) Layer(org.jwildfire.create.tina.base.Layer) File(java.io.File)

Example 27 with RGBPalette

use of org.jwildfire.create.tina.palette.RGBPalette in project JWildfire by thargor6.

the class RandomGradientMutation method execute.

@Override
public void execute(Layer pLayer) {
    int keyFrames = 3 + Tools.randomInt(56);
    boolean fadePaletteColors = Math.random() > 0.33;
    boolean uniformWidth = Math.random() > 0.75;
    RGBPalette palette = new AllRandomGradientGenerator().generatePalette(keyFrames, fadePaletteColors, uniformWidth);
    pLayer.setPalette(palette);
}
Also used : RGBPalette(org.jwildfire.create.tina.palette.RGBPalette) AllRandomGradientGenerator(org.jwildfire.create.tina.randomgradient.AllRandomGradientGenerator)

Example 28 with RGBPalette

use of org.jwildfire.create.tina.palette.RGBPalette 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 29 with RGBPalette

use of org.jwildfire.create.tina.palette.RGBPalette 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

RGBPalette (org.jwildfire.create.tina.palette.RGBPalette)29 ArrayList (java.util.ArrayList)12 Layer (org.jwildfire.create.tina.base.Layer)9 File (java.io.File)8 Flame (org.jwildfire.create.tina.base.Flame)8 RGBColor (org.jwildfire.create.tina.palette.RGBColor)5 RenderedFlame (org.jwildfire.create.tina.render.RenderedFlame)5 SimpleImage (org.jwildfire.image.SimpleImage)5 Field (java.lang.reflect.Field)4 JFileChooser (javax.swing.JFileChooser)4 XForm (org.jwildfire.create.tina.base.XForm)4 ImageReader (org.jwildfire.io.ImageReader)4 List (java.util.List)3 MedianCutQuantizer (org.jwildfire.create.tina.palette.MedianCutQuantizer)3 HashMap (java.util.HashMap)2 JLabel (javax.swing.JLabel)2 Test (org.junit.Test)2 QualityProfile (org.jwildfire.base.QualityProfile)2 ResolutionProfile (org.jwildfire.base.ResolutionProfile)2 MotionCurve (org.jwildfire.create.tina.base.motion.MotionCurve)2