private void exportToMovieFile(File file, final VideoFormat videoFormat, final int fromValue, final int toValue) {
file = videoFormat.ensureFileExtension(file);
final Rectangle2D bounds = getCanvasBounds().getBounds2D();
final int width = (int) Math.round(bounds.getWidth());
final int height = (int) Math.round(bounds.getHeight());
final Movie movie = new Movie(file.getAbsolutePath(), videoFormat, width, height, false);
exportThreadedRange(controller.getNodeLibrary(), fromValue, toValue, new ExportDelegate() {
@Override
public void frameDone(double frame, Iterable<?> results) {
movie.addFrame(ObjectsRenderer.createMovieImage(results, bounds));
}
@Override
void exportDone() {
progressDialog.setTitle("Converting frames to movie...");
progressDialog.reset();
FramesWriter w = new FramesWriter(progressDialog);
movie.save(w);
}
});
}