#

Listato 11

Creazione dei menu di testo per i 16:9
 
<!--
DVD authoring suite
maketextmenu.wsf
(c) copyright 2005-2009 Roberto Ceccarelli
-->

<job>
<runtime>
<named name="filename" helpstring="Il nomefile del menu" required="true" type="string" />
<named name="backfile" helpstring="Il file con lo sfondo" required="true" type="string" />
<named name="menutext" helpstring="Il titolo del menu" required="true" type="string" />
<named name="item1" helpstring="Voce di menu n.1" required="true" type="string" />
<named name="item2" helpstring="Voce di menu n.2" required="false" type="string" />
<named name="item3" helpstring="Voce di menu n.3" required="false" type="string" />
<named name="item4" helpstring="Voce di menu n.4" required="false" type="string" />
<named name="item5" helpstring="Voce di menu n.5" required="false" type="string" />
<named name="font" helpstring="Eventuale tipo di carattere (default: verdana)" required="false" type="string" />
<named name="pointsize" helpstring="Eventuale dimensione del carattere (default: 60)" required="false" type="string" />
<named name="color" helpstring="Eventuale colore del carattere (default: white)" required="false" type="string" />
</runtime>

<script language="JScript">
// dichiarazione variabili
var filename, backfile, menutext;
var im;
var font,pointsize,color;

// controllo che esista l'argomento principale
if( !WScript.Arguments.Named.Exists("filename") || !WScript.Arguments.Named.Exists("backfile") || !WScript.Arguments.Named.Exists("menutext") || !WScript.Arguments.Named.Exists("item1") )
{
        WScript.Arguments.ShowUsage();
        WScript.Quit();
}
filename = WScript.Arguments.Named("filename");
backfile = WScript.Arguments.Named("backfile");
menutext = WScript.Arguments.Named("menutext");
item1 = WScript.Arguments.Named("item1");
if( WScript.Arguments.Named.Exists("font") )
{
        font = WScript.Arguments.Named("font");
}
else  
{
        font = "verdanab.ttf";
}
if( WScript.Arguments.Named.Exists("pointsize") )
{
        pointsize = WScript.Arguments.Named("pointsize");
}
else  
{
        pointsize = "60";
}
if( WScript.Arguments.Named.Exists("color") )
{
        color = WScript.Arguments.Named("color");
}
else  
{
        color = "red";
}

im = WScript.CreateObject("ImageMagickObject.MagickImage.1");
var arr = new Array();

arr[0] = backfile;
cnt = 0;
arr[cnt*4+1] = item1+".png";
arr[cnt*4+2] = "-geometry";
ypos=150+90*cnt;
arr[cnt*4+3] = "+64+"+ypos;
arr[cnt*4+4] = "-composite";
if( WScript.Arguments.Named.Exists("item2") )
{
        cnt++;
        arr[cnt*4+1] = WScript.Arguments.Named("item2")+".png";
        arr[cnt*4+2] = "-geometry";
        ypos=150+90*cnt;
        arr[cnt*4+3] = "+64+"+ypos;
        arr[cnt*4+4] = "-composite";
}
if( WScript.Arguments.Named.Exists("item3") )
{
        cnt++;
        arr[cnt*4+1] = WScript.Arguments.Named("item3")+".png";
        arr[cnt*4+2] = "-geometry";
        ypos=150+90*cnt;
        arr[cnt*4+3] = "+64+"+ypos;
        arr[cnt*4+4] = "-composite";
}
if( WScript.Arguments.Named.Exists("item4") )
{
        cnt++;
        arr[cnt*4+1] = WScript.Arguments.Named("item4")+".png";
        arr[cnt*4+2] = "-geometry";
        ypos=150+90*cnt;
        arr[cnt*4+3] = "+64+"+ypos;
        arr[cnt*4+4] = "-composite";
}
if( WScript.Arguments.Named.Exists("item5") )
{
        cnt++;
        arr[cnt*4+1] = WScript.Arguments.Named("item5")+".png";
        arr[cnt*4+2] = "-geometry";
        ypos=150+90*cnt;
        arr[cnt*4+3] = "+64+"+ypos;
        arr[cnt*4+4] = "-composite";
}
arr[cnt*4+5] = "-font";
arr[cnt*4+6] = font;
arr[cnt*4+7] = "-pointsize";
arr[cnt*4+8] = pointsize;
arr[cnt*4+9] = "-draw";
arr[cnt*4+10] = "gravity north stroke white fill "+color+" text 0,50 '"+menutext+"'";
arr[cnt*4+11] = "-resize";
arr[cnt*4+12] = "720x576!";

var cmd = "im.Convert(\"" + arr.join("\",\"")+"\",\""+filename+".jpg\")";
WScript.StdOut.WriteLine(cmd);
eval(cmd);
//x = WScript.StdIn.ReadLine();
// creazione maschere
var arrm = new Array();

arrm[0] = "xc:transparent";
arrm[1] = "-resize";
arrm[2] = "1024x576!";
for(j=0; j <= cnt; j++)
{
  arrm[j*4+3] = WScript.Arguments.Named("item"+(j+1))+"_mask.png";
  arrm[j*4+4] = arr[j*4+2];
  arrm[j*4+5] = arr[j*4+3];
  arrm[j*4+6] = arr[j*4+4];
}
arrm[j*4+3] = "-sample";
arrm[j*4+4] = "720x576!";

var cmd = "im.Convert(\"" + arrm.join("\",\"")+"\",\""+filename+"_169_mask.png\")";
WScript.StdOut.WriteLine(cmd);
eval(cmd);
//x = WScript.StdIn.ReadLine();

arrm[j*4+4] = "720x432!";

var cmd = "im.Convert(\"" + arrm.join("\",\"")+"\",\""+filename+"_page_43_mask.png\")";
WScript.StdOut.WriteLine(cmd);
eval(cmd);
//x = WScript.StdIn.ReadLine();

im.Convert("xc:transparent","-resize","720x576!",filename+"_page_43_mask.png","-geometry","+0+72","-composite",filename+"_43_mask.png")
</script>
</job>
Inizio pagina
Home page
 
Creative Commons  License BY-NC-SA
Ove non diversamente specificato i contenuti del sito sono rilasciati con licenza Creative Commons BY-NC-SA 4.0 

Copyright © 2007-2020 The Strawberry Field - Roberto Ceccarelli