X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fswfextract.c;h=13294164f5ed03ac56cd20967ebefecc04f1c60b;hb=f3bc04e70501213ea1d9d2aa22d5c2fa550dab3f;hp=965cfd3fecf3237acdc75fa9746bcb5ea4b1c266;hpb=07529c8dd0ce0d0e7e485a9f562afdd2bbad6184;p=swftools.git diff --git a/src/swfextract.c b/src/swfextract.c index 965cfd3..1329416 100644 --- a/src/swfextract.c +++ b/src/swfextract.c @@ -356,6 +356,7 @@ void extractTag(SWF*swf, char*filename) if(!originalplaceobjects && (extractids||extractname_id>=0)) { int number = 0; int id = 0; + int t; TAG* objtag = 0; SRECT bbox; memset(&bbox, 0, sizeof(SRECT)); @@ -367,6 +368,7 @@ void extractTag(SWF*swf, char*filename) } if(number>=2) printf("warning! You should use the -P when extracting multiple objects\n"); + if(number == 1) { /* if there is only one object, we will scale it. So let's figure out it's bounding box */ @@ -379,11 +381,15 @@ void extractTag(SWF*swf, char*filename) } tag = tag->next; } - } + newswf.movieSize.xmin = 0; + newswf.movieSize.ymin = 0; + newswf.movieSize.xmax = 512*20; + newswf.movieSize.ymax = 512*20; + } else { + if((objectbbox.xmin|objectbbox.ymin|objectbbox.xmax|objectbbox.ymax)!=0) + newswf.movieSize = objectbbox; + } - int t; - if((objectbbox.xmin|objectbbox.ymin|objectbbox.xmax|objectbbox.ymax)!=0) - newswf.movieSize = objectbbox; if(extractname_id>=0) { desttag = swf_InsertTag(desttag, ST_PLACEOBJECT2); swf_ObjectPlace(desttag, extractname_id, extractname_id, 0,0,extractname); @@ -403,7 +409,7 @@ void extractTag(SWF*swf, char*filename) m.sx = (512*20*65536)/max; m.sy = (512*20*65536)/max; } - newswf.movieSize = swf_TurnRect(newswf.movieSize, &m); + //newswf.movieSize = swf_TurnRect(newswf.movieSize, &m); } swf_ObjectPlace(desttag, t, t, &m,0,0); } @@ -830,12 +836,21 @@ void handlelossless(TAG*tag) png_write_byte(fi,palette[t].b); } png_end_chunk(fi); + + if(alpha) { + /* write alpha palette */ + png_start_chunk(fi, "tRNS", 256); + for(t=0;t<256;t++) { + png_write_byte(fi,palette[t].a); + } + png_end_chunk(fi); + } } { int pos2 = 0; int x,y; int srcwidth = width * (bpp/8); - datalen3 = width*height*4; + datalen3 = (width*4+5)*height; data3 = (U8*)malloc(datalen3); for(y=0;y