PIYiPhone
function init(){/* print("test script init");*/}
function run()
{
var filename = QFileDialog.getSaveFileName(this, "MuseScore: Save PIY", "/Users/mikhail/dev/piy/stuff/Content/4iphone_final/*", "");
var fmt = curScore.pageFormat;
var mydpmm = 200 / fmt.height;
if( fmt.width * mydpmm > 32000){
mydpmm = 32000/fmt.width;
}
mydpi = mydpmm * 25.4
curScore.save(filename,"png",false,true,mydpi,false);
//var mydpi = 2 * 200 * 25.4 / fmt.height;
//curScore.save(filename + "@2x","png",false,true,mydpi,false);
var image = new QImage( filename + '-1.png','PNG' );
var hh = image.height();
//var image400 = image.
curLeft = 0;
var i = 1;
while (curLeft <= image.width()){
crop = image.copy(curLeft,0,768, hh);
cropsmall = crop.scaledToHeight(200,false);
cropsmall.save(filename + '-' + i.toString() + '.png','PNG');
curLeft += 768;
i++;
}
curScore.save(filename,"xml");
mb = new QMessageBox();
mb.setWindowTitle("MuseScore: Export plugin.");
mb.text = "Hello MuseScore!";
mb.exec();
}
var mscorePlugin = {
majorVersion: 1,
minorVersion: 1,
menu: 'Plugins.piyPhone',
init: init,
run: run
};
mscorePlugin;