use of org.jwildfire.create.tina.io.FlameReader in project JWildfire by thargor6.
the class TinaController method grabPaletteFromFlameButton_actionPerformed.
public void grabPaletteFromFlameButton_actionPerformed(ActionEvent e) {
JFileChooser chooser = new FlameFileChooser(prefs);
if (prefs.getInputFlamePath() != null) {
try {
chooser.setCurrentDirectory(new File(prefs.getInputFlamePath()));
} catch (Exception ex) {
ex.printStackTrace();
}
}
if (chooser.showOpenDialog(centerPanel) == JFileChooser.APPROVE_OPTION) {
File file = chooser.getSelectedFile();
List<Flame> flames = new FlameReader(prefs).readFlames(file.getAbsolutePath());
Flame flame = flames.get(0);
prefs.setLastInputFlameFile(file);
RGBPalette palette = flame.getFirstLayer().getPalette();
data.paletteKeyFrames = null;
saveUndoPoint();
getCurrLayer().setPalette(palette);
setLastGradient(palette);
refreshPaletteColorsTable();
refreshPaletteUI(palette);
refreshFlameImage(true, false, 1, true, false);
}
}
use of org.jwildfire.create.tina.io.FlameReader in project JWildfire by thargor6.
the class MeshGenController method loadFlameButton_clicked.
public void loadFlameButton_clicked() {
try {
JFileChooser chooser = new FlameFileChooser(prefs);
if (prefs.getInputFlamePath() != null) {
try {
chooser.setCurrentDirectory(new File(prefs.getInputFlamePath()));
} catch (Exception ex) {
ex.printStackTrace();
}
}
if (chooser.showOpenDialog(rootPanel) == JFileChooser.APPROVE_OPTION) {
File file = chooser.getSelectedFile();
List<Flame> flames = new FlameReader(prefs).readFlames(file.getAbsolutePath());
Flame newFlame = flames.get(0);
prefs.setLastInputFlameFile(file);
importFlame(newFlame);
}
} catch (Throwable ex) {
errorHandler.handleError(ex);
}
}
use of org.jwildfire.create.tina.io.FlameReader in project JWildfire by thargor6.
the class CacheRendererThread method renderFlame.
private SimpleImage renderFlame(FlameFlatNode pNode, int pImgWidth, int pImgHeight) {
List<Flame> flames = new FlameReader(prefs).readFlames(pNode.getFilename());
if (flames.size() > 0) {
Flame renderFlame = flames.get(0);
RenderInfo info = new RenderInfo(pImgWidth, pImgHeight, RenderMode.PREVIEW);
double wScl = (double) info.getImageWidth() / (double) renderFlame.getWidth();
double hScl = (double) info.getImageHeight() / (double) renderFlame.getHeight();
renderFlame.setPixelsPerUnit((wScl + hScl) * 0.5 * renderFlame.getPixelsPerUnit());
renderFlame.setWidth(pImgWidth);
renderFlame.setHeight(pImgHeight);
renderFlame.setSampleDensity(prefs.getTinaRenderPreviewQuality() / 3.0);
FlameRenderer renderer = new FlameRenderer(renderFlame, prefs, false, true);
RenderedFlame renderRes = renderer.renderFlame(info);
return renderRes.getImage();
}
return null;
}
use of org.jwildfire.create.tina.io.FlameReader in project JWildfire by thargor6.
the class BatchRendererController method showImageBtn_clicked.
public void showImageBtn_clicked() {
try {
Job job = getCurrJob();
if (job != null) {
List<Flame> flames = new FlameReader(Prefs.getPrefs()).readFlames(job.getFlameFilename());
Flame flame = flames.get(0);
String primaryFilename = job.getImageFilename(flame.getStereo3dMode());
File imageFile = new File(primaryFilename);
if (imageFile.exists()) {
tinaController.getMainController().loadImage(imageFile.getAbsolutePath(), false);
} else {
StandardDialogs.message(rootPanel, "No rendered image found");
}
}
} catch (Throwable ex) {
errorHandler.handleError(ex);
}
}
use of org.jwildfire.create.tina.io.FlameReader in project JWildfire by thargor6.
the class IFlamesController method loadIFlameButton_clicked.
public void loadIFlameButton_clicked() {
try {
JFileChooser chooser = new FlameFileChooser(prefs);
if (prefs.getInputFlamePath() != null) {
try {
chooser.setCurrentDirectory(new File(prefs.getInputFlamePath()));
} catch (Exception ex) {
ex.printStackTrace();
}
}
if (chooser.showOpenDialog(centerPanel) == JFileChooser.APPROVE_OPTION) {
File file = chooser.getSelectedFile();
List<Flame> flames = new FlameReader(prefs).readFlames(file.getAbsolutePath());
Flame flame = flames.get(0);
prefs.setLastInputFlameFile(file);
importFlame(flame);
getFlame().setLastFilename(file.getName());
messageHelper.showStatusMessage(getFlame(), "opened from disc");
}
} catch (Throwable ex) {
errorHandler.handleError(ex);
}
}
Aggregations