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 Bitmap smoothing
24 * Requires: MING-0.4.3 (00040300)
26 ***********************************************************************/
32 #include "ming_utils.h"
35 main(int argc
, char **argv
)
46 SWFMovieClip dejagnuclip
;
47 char outputFilename
[256];
51 fprintf(stderr
, "Usage: %s <swf_version>\n", argv
[0]);
55 swfversion
= atoi(argv
[1]);
56 sprintf(outputFilename
, "BitmapSmoothingTest-v%d.swf", swfversion
);
58 /*********************************************
62 *********************************************/
65 puts("Setting things up");
68 Ming_useSWFVersion (swfversion
);
70 mo
= newSWFMovieWithVersion(swfversion
);
72 /****************************************************
73 * Create filled shapes mc
74 ****************************************************/
75 imgfile
= fopen(MEDIADIR
"/vstroke.png", "rb");
77 fprintf(stderr
, "Failed to open bitmap file");
81 // Note that recent ming version have the more convenient
82 // newSWFInput_filename() function, but we want to support
84 in
= newSWFInput_file(imgfile
);
85 bitmap
= newSWFBitmap_fromInput(in
);
90 shpSmt
= newSWFShapeFromBitmap(bitmap
,
91 SWFFILL_CLIPPED_BITMAP
);
93 shpHrd
= newSWFShapeFromBitmap(bitmap
,
94 SWFFILL_NONSMOOTHED_CLIPPED_BITMAP
);
96 mc
= newSWFMovieClip();
97 SWFMovieClip_add(mc
, (SWFBlock
)shpSmt
);
98 it
= SWFMovieClip_add(mc
, (SWFBlock
)shpHrd
);
99 SWFDisplayItem_moveTo(it
, 0, 5);
100 SWFMovieClip_nextFrame(mc
);
102 /****************************************************
103 * Create filled shapes mc, and scale it
104 ****************************************************/
106 it
= SWFMovie_add(mo
, (SWFBlock
)mc
);
107 SWFDisplayItem_scaleTo(it
, 30, 10);
109 SWFMovie_setDimension(mo
, SWFBitmap_getWidth(bitmap
)*30, 500);
111 /****************************************************
113 ****************************************************/
115 font
= get_default_font(MEDIADIR
);
116 dejagnuclip
= get_dejagnu_clip((SWFBlock
)font
, 10, 0, 0, 200, 200);
117 it
= SWFMovie_add(mo
, (SWFBlock
)dejagnuclip
);
118 SWFDisplayItem_setDepth(it
, 200);
119 SWFDisplayItem_move(it
, 0, 100);
121 /****************************************************
123 ****************************************************/
126 /****************************************************
128 ****************************************************/
130 printf("Saving %s\n", outputFilename
);
132 SWFMovie_nextFrame(mo
); /* showFrame */
134 SWFMovie_save(mo
, outputFilename
);