X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fswfcombine.c;h=7c675af9ba6a5d29260476fe0407ea82cb392d06;hb=2689b541f1a0f9a767ac8fe55909183d2c9a7347;hp=cc3bffca661bf6b9ef671eecf4b15becfdc759ec;hpb=aee9de2c6eb23628e54b6896f5b441d9b39317c1;p=swftools.git diff --git a/src/swfcombine.c b/src/swfcombine.c index cc3bffc..7c675af 100644 --- a/src/swfcombine.c +++ b/src/swfcombine.c @@ -103,12 +103,14 @@ int args_callback_option(char*name,char*val) { } else if (!strcmp(name, "x")) { - config.movex = atoi(val); + float x = atof(val); + config.movex = (int)(x*20+0.5); return 1; } else if (!strcmp(name, "y")) { - config.movey = atoi(val); + float y = atof(val); + config.movey = (int)(y*20+0.5); return 1; } else if (!strcmp(name, "m")) @@ -133,7 +135,13 @@ int args_callback_option(char*name,char*val) { } else if (!strcmp(name, "r")) { - config.framerate = atoi(val)*256/100; + + float rate = atof(val); + if ((rate < 1.0/256) ||(rate >= 256.0)) { + fprintf(stderr, "Error: You must specify a valid framerate between 1/256 and 255.\n"); + exit(1); + } + config.framerate = (int)(rate*256); return 1; } else if (!strcmp(name, "X")) @@ -262,15 +270,15 @@ void args_callback_usage(char*name) printf("-a --cat concatenate all slave files (no master movie)\n"); printf("-l --overlay Don't remove any master objects, only overlay new objects\n"); printf("-c --clip Clip the slave objects by the corresponding master objects\n"); - printf("-v --verbose Use more than one -v for greater effect \n"); - printf("-d --dummy Don't require slave objects \n"); + printf("-v --verbose Be verbose. Use more than one -v for greater effect \n"); + printf("-d --dummy Don't require slave objects (for changing movie attributes)\n"); printf("-f --frame The following identifier is a frame or framelabel, not an id or objectname\n"); - printf("-x xpos --movex x Adjust position of slave by xpos twips (1/20 pixel)\n"); - printf("-y ypos --movey y Adjust position of slave by ypos twips (1/20 pixel)\n"); - printf("-s scale --scale Adjust size of slave by scale%\n"); - printf("-r framerate --rate Set movie framerate (100 frames/sec)\n"); - printf("-X width --width Force movie width to scale (default: use master width (not with -t))\n"); - printf("-Y height --height Force movie height to scale (default: use master height (not with -t))\n"); + printf("-x xpos --movex x Adjust position of slave by xpos pixels\n"); + printf("-y ypos --movey y Adjust position of slave by ypos pixels\n"); + printf("-s scale --scale Adjust size of slave by scale% (e.g. 100%% = original size)\n"); + printf("-r framerate --rate Set movie framerate (frames/sec)\n"); + printf("-X width --width Force movie bbox width to scale (default: use master width (not with -t))\n"); + printf("-Y height --height Force movie bbox height to scale (default: use master height (not with -t))\n"); printf("-z zlib --zlib Enable Flash 6 (MX) Zlib Compression\n"); } @@ -372,6 +380,7 @@ static char* slavename = 0; static int slaveid = -1; static int slaveframe = -1; static char masterbitmap[65536]; +static char depthbitmap[65536]; #define FLAGS_WRITEDEFINES 1 #define FLAGS_WRITENONDEFINES 2 @@ -883,14 +892,21 @@ void normalcombine(SWF*master, char*slave_name, SWF*slave, SWF*newswf) int frame = 0; char*framelabel; TAG * tag = master->firstTag; + + memset(depthbitmap, 0, sizeof(depthbitmap)); // set the idtab while(tag) { + int depth = swf_GetDepth(tag); + if(depth>=0) { + depthbitmap[depth] = 1; + } if(swf_isDefiningTag(tag)) { int defineid = swf_GetDefineID(tag); msg(" tagid %02x defines object %d", tag->id, defineid); masterbitmap[defineid] = 1; + if (!slavename && defineid==slaveid) { if(defineid>=0) { spriteid = defineid; @@ -938,6 +954,7 @@ void normalcombine(SWF*master, char*slave_name, SWF*slave, SWF*newswf) } swf_Relocate (slave, masterbitmap); + swf_RelocateDepth (slave, depthbitmap); jpeg_assert(slave, master); if (config.overlay)