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 ***********************************************************************/
30 #define OUTPUT_VERSION 6
31 #define OUTPUT_FILENAME "definebitsjpeg2.swf"
33 #define URL_RED "red.jpg"
36 main(int argc
, char **argv
)
39 const char *jpeg_filename
="red.jpg";
41 SWFJpegBitmap jpeg_bm
;
45 /*********************************************
49 *********************************************/
51 if ( argc
> 1 ) jpeg_filename
=argv
[1];
54 fprintf(stderr
, "Usage: %s <jpegfile>\n", argv
[0]);
58 puts("Setting things up");
61 Ming_useSWFVersion (OUTPUT_VERSION
);
62 Ming_setScale(1.0); /* so we talk twips */
66 /*****************************************************
70 *****************************************************/
74 jpeg_fd
= fopen(jpeg_filename
, "r");
76 perror(jpeg_filename
);
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
);