1 /*
2  *   Copyright (C) 2005, 2006, 2009, 2010, 2011 Free Software Foundation, Inc.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
16  *
17  *
18  */
19 
20 /*
21  * Generate a Dejagnu.swf file for import from self-contained
22  * SWF testcases
23  *
24  * run as ./Dejagnu <mediadir>
25  */
26 
27 #include <stdlib.h>
28 #include <stdio.h>
29 #include <ming.h>
30 
31 #include "ming_utils.h"
32 
33 #define OUTPUT_VERSION 5
34 #define OUTPUT_FILENAME "Dejagnu.swf"
35 
36 int
main(int argc,char ** argv)37 main(int argc, char** argv)
38 {
39 	SWFMovie mo;
40 	SWFMovieClip dejaclip;
41 	const char *srcdir=".";
42 	SWFFont bfont;
43 
44 
45 	/*********************************************
46 	 *
47 	 * Initialization
48 	 *
49 	 *********************************************/
50 
51 	if ( argc>1 ) srcdir=argv[1];
52 	else
53 	{
54 		fprintf(stderr, "Usage: %s <mediadir>\n", argv[0]);
55 		return 1;
56 	}
57 
58 	puts("Setting things up");
59 
60 	Ming_init();
61         Ming_useSWFVersion (OUTPUT_VERSION);
62 	Ming_setScale(20.0); /* let's talk pixels */
63 
64 	mo = newSWFMovie();
65 	SWFMovie_setRate(mo, 1);
66 	SWFMovie_setDimension(mo, 628, 1024);
67 
68 	bfont = get_default_font(srcdir);
69 
70 	/*********************************************
71 	 *
72 	 * Body
73 	 *
74 	 *********************************************/
75 
76 	dejaclip = get_dejagnu_clip((SWFBlock)bfont, 3000, 0, 50, 800, 800);
77 
78 	SWFMovie_add(mo, (SWFBlock)dejaclip);
79 	SWFMovie_addExport(mo, (SWFBlock)dejaclip, "dejagnu");
80 	SWFMovie_addExport(mo, (SWFBlock)SWFMovie_addFont(mo, bfont),
81 		"dejafont");
82 
83 	SWFMovie_nextFrame(mo); /* showFrame */
84 
85 
86 	/*****************************************************
87 	 *
88 	 * Output movie
89 	 *
90 	 *****************************************************/
91 
92 	puts("Saving " OUTPUT_FILENAME );
93 
94 	SWFMovie_save(mo, OUTPUT_FILENAME);
95 
96 	return 0;
97 }
98