use of com.xenoage.zong.desktop.io.png.out.PngScoreDocFileOutput in project Zong by Xenoage.
the class Content method saveAs.
/**
* Saves the current score using the given format.
* pdf, png, mid and ogg is supported by this demo.
*/
public void saveAs(String format) {
FileOutput<ScoreDoc> out = null;
switch(format) {
case "pdf":
out = new PdfScoreDocFileOutput();
break;
case "png":
out = new PngScoreDocFileOutput();
break;
case "mid":
out = new MidiScoreDocFileOutput();
break;
case "ogg":
out = new OggScoreDocFileOutput();
break;
default:
return;
}
String filePath = "demo." + format;
try {
DocumentIO.write(scoreDoc, new File(filePath), out);
mainWindow.showMessageDialog(filePath + " saved.");
} catch (Exception ex) {
Err.handle(Report.Companion.error(ex));
}
}
use of com.xenoage.zong.desktop.io.png.out.PngScoreDocFileOutput in project Zong by Xenoage.
the class VisualHtmlReport method renderScore.
/**
* Renders the given score into an image file.
*/
private void renderScore(File scoreFile) throws IOException {
ScoreDoc doc = DocumentIO.read(scoreFile, new MusicXmlScoreDocFileInput());
File pngFile = new File(new File(dirReport, appDir), scoreFile.getName() + ".png");
DocumentIO.write(doc, pngFile, new PngScoreDocFileOutput());
cropScoreImage(pngFile);
}
Aggregations