int main(int argc, char **argv) { SWFMovie mo; SWFInput in; SWFBitmap bitmap; SWFShape shpSmt; SWFShape shpHrd; SWFMovieClip mc; SWFDisplayItem it; int swfversion; SWFFont font; SWFMovieClip dejagnuclip; char outputFilename[256]; FILE* imgfile; if ( argc < 2 ) { fprintf(stderr, "Usage: %s <swf_version>\n", argv[0]); exit(EXIT_FAILURE); } swfversion = atoi(argv[1]); sprintf(outputFilename, "BitmapSmoothingTest-v%d.swf", swfversion); /********************************************* * * Initialization * *********************************************/ puts("Setting things up"); Ming_init(); Ming_useSWFVersion (swfversion); mo = newSWFMovieWithVersion(swfversion); /**************************************************** * Create filled shapes mc ****************************************************/ imgfile = fopen(MEDIADIR"/vstroke.png", "rb"); if (!imgfile) { fprintf(stderr, "Failed to open bitmap file"); return EXIT_FAILURE; } // Note that recent ming version have the more convenient // newSWFInput_filename() function, but we want to support // older versions. in = newSWFInput_file(imgfile); bitmap = newSWFBitmap_fromInput(in); if (!bitmap) { return EXIT_FAILURE; } shpSmt = newSWFShapeFromBitmap(bitmap, SWFFILL_CLIPPED_BITMAP); shpHrd = newSWFShapeFromBitmap(bitmap, SWFFILL_NONSMOOTHED_CLIPPED_BITMAP); mc = newSWFMovieClip(); SWFMovieClip_add(mc, (SWFBlock)shpSmt); it = SWFMovieClip_add(mc, (SWFBlock)shpHrd); SWFDisplayItem_moveTo(it, 0, 5); SWFMovieClip_nextFrame(mc); /**************************************************** * Create filled shapes mc, and scale it ****************************************************/ it = SWFMovie_add(mo, (SWFBlock)mc); SWFDisplayItem_scaleTo(it, 30, 10); SWFMovie_setDimension(mo, SWFBitmap_getWidth(bitmap)*30, 500); /**************************************************** * Add dejagnu clip ****************************************************/ font = get_default_font(MEDIADIR); dejagnuclip = get_dejagnu_clip((SWFBlock)font, 10, 0, 0, 200, 200); it = SWFMovie_add(mo, (SWFBlock)dejagnuclip); SWFDisplayItem_setDepth(it, 200); SWFDisplayItem_move(it, 0, 100); /**************************************************** * TODO: Add actions ****************************************************/ /**************************************************** * Save things up ****************************************************/ printf("Saving %s\n", outputFilename); SWFMovie_nextFrame(mo); /* showFrame */ SWFMovie_save(mo, outputFilename); fclose(imgfile); return EXIT_SUCCESS; }
EXPORT BOOL WINAPI i_scaleTo(float xScale, float yScale, int p3, int p4) { lstrcpy(funcname, "i_scaleTo"); SWFDisplayItem_scaleTo(mhsp_item, xScale, yScale); return 0; }