use of org.jwildfire.create.tina.io.FlameMovieReader in project JWildfire by thargor6.
the class TinaSWFAnimatorController method movieFromDiscButton_clicked.
public void movieFromDiscButton_clicked() {
try {
JFileChooser chooser = new JWFMovieFileChooser(prefs);
if (prefs.getInputJWFMoviePath() != null) {
try {
chooser.setCurrentDirectory(new File(prefs.getInputJWFMoviePath()));
} catch (Exception ex) {
ex.printStackTrace();
}
}
if (chooser.showOpenDialog(swfAnimatorFlamesPanel) == JFileChooser.APPROVE_OPTION) {
File file = chooser.getSelectedFile();
FlameMovie movie = new FlameMovieReader(prefs).readMovie(file.getAbsolutePath());
if (movie != null) {
randomBatch.add(0, new MovieThumbnail(movie, null));
currMovie = movie;
updateThumbnails();
}
refreshControls();
previewFlameImage();
}
} catch (Throwable ex) {
errorHandler.handleError(ex);
}
}
use of org.jwildfire.create.tina.io.FlameMovieReader in project JWildfire by thargor6.
the class JWFMovieFilePreview method createThumbnail.
public void createThumbnail() {
if (currFile == null) {
currThumbnail = null;
return;
}
try {
if (currFile.exists()) {
FlameMovie movie = new FlameMovieReader(prefs).readMovie(currFile.getAbsolutePath());
Flame flame = null;
if (movie != null) {
for (FlameMoviePart part : movie.getParts()) {
if (part.getFlame() != null) {
flame = part.getFlame();
break;
}
}
}
if (flame != null) {
int imgWidth = this.getPreferredSize().width;
int imgHeight = this.getPreferredSize().height;
double wScl = (double) imgWidth / (double) flame.getWidth();
double hScl = (double) imgHeight / (double) flame.getHeight();
flame.setPixelsPerUnit((wScl + hScl) * 0.5 * flame.getPixelsPerUnit());
flame.setWidth(imgWidth);
flame.setHeight(imgHeight);
FlameRenderer renderer = new FlameRenderer(flame, prefs, false, true);
renderer.setProgressUpdater(null);
flame.setSampleDensity(50);
flame.setSpatialFilterRadius(0.0);
RenderInfo info = new RenderInfo(imgWidth, imgHeight, RenderMode.PREVIEW);
RenderedFlame res = renderer.renderFlame(info);
currThumbnail = new ImageIcon(res.getImage().getBufferedImg());
}
}
} catch (Exception ex) {
currThumbnail = null;
if (ex.getCause() != null) {
ex.getCause().printStackTrace();
} else {
ex.printStackTrace();
}
}
}
use of org.jwildfire.create.tina.io.FlameMovieReader in project JWildfire by thargor6.
the class TinaSWFAnimatorController method movieFromClipboardButton_clicked.
public void movieFromClipboardButton_clicked() {
try {
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
Transferable clipData = clipboard.getContents(clipboard);
if (clipData != null) {
if (clipData.isDataFlavorSupported(DataFlavor.stringFlavor)) {
String xml = (String) (clipData.getTransferData(DataFlavor.stringFlavor));
FlameMovie movie = new FlameMovieReader(prefs).readMovieFromXML(xml);
if (movie != null) {
randomBatch.add(0, new MovieThumbnail(movie, null));
currMovie = movie;
updateThumbnails();
}
refreshControls();
previewFlameImage();
}
}
} catch (Throwable ex) {
errorHandler.handleError(ex);
}
}
Aggregations