big merge from master, fix rpm creation, drop fetching swfdec
[gnash.git] / testsuite / misc-ming.all / definebitsjpeg2.c
blobd8ed41170644a1d6bb25622f9afbf17ee9996a16
1 /***********************************************************************
3 * Copyright (C) 2005, 2006, 2009, 2010, 2011 Free Software Foundation, Inc.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 ***********************************************************************
23 * Test case for the DefineBitsJPEG2 tag
25 ***********************************************************************/
27 #include <stdio.h>
28 #include <ming.h>
30 #define OUTPUT_VERSION 6
31 #define OUTPUT_FILENAME "definebitsjpeg2.swf"
33 #define URL_LYNCH "lynch.jpg"
35 int
36 main(int argc, char **argv)
38 SWFMovie mo;
39 const char *jpeg_filename="lynch.jpg";
40 FILE *jpeg_fd;
41 SWFJpegBitmap jpeg_bm;
42 SWFShape jpeg_sh;
43 SWFMovieClip jpeg_mc;
45 /*********************************************
47 * Initialization
49 *********************************************/
51 if ( argc > 1 ) jpeg_filename=argv[1];
52 else
54 fprintf(stderr, "Usage: %s <jpegfile>\n", argv[0]);
55 return 1;
58 puts("Setting things up");
60 Ming_init();
61 Ming_useSWFVersion (OUTPUT_VERSION);
62 Ming_setScale(1.0); /* so we talk twips */
64 mo = newSWFMovie();
66 /*****************************************************
68 * Add the LYNCH clip
70 *****************************************************/
72 puts("Adding lynch");
74 jpeg_fd = fopen(jpeg_filename, "r");
75 if ( ! jpeg_fd ) {
76 perror(jpeg_filename);
77 return 1;
79 jpeg_bm = newSWFJpegBitmap(jpeg_fd);
80 jpeg_sh = newSWFShapeFromBitmap((SWFBitmap)jpeg_bm, SWFFILL_CLIPPED_BITMAP);
81 jpeg_mc = newSWFMovieClip();
82 SWFMovieClip_add(jpeg_mc, (SWFBlock)jpeg_sh);
83 SWFMovieClip_nextFrame(jpeg_mc); /* showFrame */
85 SWFMovie_add(mo, (SWFBlock)jpeg_mc);
88 puts("Saving " OUTPUT_FILENAME );
90 SWFMovie_nextFrame(mo); /* showFrame */
92 SWFMovie_save(mo, OUTPUT_FILENAME);
94 return 0;