#

Listato 17

Creazione delle immagini per i menu.
 
<!--
DVD authoring suite
makemenuimages.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="font" helpstring="Eventuale tipo di carattere (default: verdana)" required="false" type="string" />
<named name="pointsize" helpstring="Eventuale dimensione del carattere (default: 40)" 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;
var j;

// controllo che esista l'argomento principale
if( !WScript.Arguments.Named.Exists("filename") || !WScript.Arguments.Named.Exists("backfile")  )
{
        WScript.Arguments.ShowUsage();
        WScript.Quit();
}
filename = WScript.Arguments.Named("filename");
backfile = WScript.Arguments.Named("backfile");
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 = "40";
}
if( WScript.Arguments.Named.Exists("color") )
{
        color = WScript.Arguments.Named("color");
}
else  
{
        color = "white";
}

var size_little = new Array();
var size_large = new Array();
var pos_little = new Array();
var pos_large = new Array();
im = WScript.CreateObject("ImageMagickObject.MagickImage.1");
var oxml = WScript.CreateObject("Msxml2.DOMDocument.4.0");
oxml.async = false;
oxml.load(filename+".xml");
imgList = oxml.getElementsByTagName("image");

// generazione elementi di base
for(j=1; j<=imgList.length; j++) {
    image = imgList.item(j-1);
        tmp = image.getElementsByTagName("file");
        imgfile = tmp.item(0).text;
        if(tmp.item(0).getAttribute("aspect") == "widescreen") {
          size_little[j] = 224;
          size_large[j] = 512;
          pos_little[j] = 155;
          pos_large[j] = 443;
        } else {
          size_little[j] = 168;
          size_large[j] = 384;
          pos_little[j] = 183;
          pos_large[j] = 507;
        }
        tmp = image.getElementsByTagName("text");
        commento = tmp.item(0).text;
    im.Convert(imgfile,"-resize",size_little[j]+"x126!","-mattecolor","white","-frame","5x5+2+2","work\\"+filename+"_little"+j+".bmp");
    im.Convert(imgfile,"-resize",size_large[j]+"x288!","-mattecolor","white","-frame","5x5+2+2","work\\"+filename+"_large"+j+".bmp");
im.Convert("xc:transparent","-resize","512x126!","-font",font,"-pointsize",pointsize,"-gravity","north","-stroke","white", "-fill",color,"-annotate","+0+0",commento,"work\\"+filename+"_text"+j+".png");
        }

// assemblaggio menu
j=1;
im.Convert(backfile,"-resize","1024x576!","icone\\gohome.png","-geometry","+64+256","-composite","work\\"+filename+"_little"+(j)+".bmp","-geometry","+"+pos_little[j]+"+220","-composite","work\\"+filename+"_little"+(j+1)+".bmp","-geometry","+"+pos_little[j+1]+"+381","-composite","work\\"+filename+"_large"+(j)+".bmp","-geometry","+"+pos_large[j]+"+59","-composite","work\\"+filename+"_text"+(j)+".png","-geometry","+443+381","-composite","-resize","720x576!","work\\"+filename+(j)+".jpg");
for(j=2; j<imgList.length; j++) {
        im.Convert(backfile, "-resize","1024x576!","icone\\gohome.png","-geometry","+64+256","-composite","work\\"+filename+"_little"+(j-1)+".bmp","-geometry","+"+pos_little[j-1]+"+59","-composite","work\\"+filename+"_little"+(j)+".bmp","-geometry","+"+pos_little[j]+"+220","-composite","work\\"+filename+"_little"+(j+1)+".bmp","-geometry","+"+pos_little[j+1]+"+381","-composite","work\\"+filename+"_large"+(j)+".bmp","-geometry","+"+pos_large[j]+"+59","-composite","work\\"+filename+"_text"+(j)+".png","-geometry","+443+381","-composite","-resize","720x576!","work\\"+filename+(j)+".jpg");
        }
j=imgList.length;
im.Convert(backfile,"-resize","1024x576!","icone\\gohome.png","-geometry","+64+256","-composite","work\\"+filename+"_little"+(j-1)+".bmp","-geometry","+"+pos_little[j-1]+"+59","-composite","work\\"+filename+"_little"+(j)+".bmp","-geometry","+"+pos_little[j]+"+220","-composite","work\\"+filename+"_large"+(j)+".bmp","-geometry","+"+pos_large[j]+"+59","-composite","work\\"+filename+"_text"+(j)+".png","-geometry","+443+381","-composite","-resize","720x576!","work\\"+filename+(j)+".jpg");       

</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