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);
}
}
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);
}
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());
}
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);
}
}
Aggregations